title: Reading from .csv into a 1d array - perl
body: <p>I'm very new to perl. I'd like to read elements from a file and store them into a 1d array. For example,</p>
  
  <pre><code>1,6,1,0         
  2,3,0,0         
  3,2,0,0  
  
  my $filename = $ARGV[0];
  open(my $filehandle, '&lt;', $filename) or die "Could not open $filename\n";
  #
  my @resultarray;
  while(my $line = &lt;$filehandle&gt;){
      my @linearray = split("/n", $line);
  }
  while(foreach(@linearray){
      my @resultarray = split(",", $linearray);
  }
  </code></pre>
  
  <p>Is this approach okay? If I'd like to read it into a 2d array, is it easier?</p>
  
  <p>Thanks!</p>