in reply to dynamic 2d array
Chiming in a bit late after a YAPC::EU visit.
Note that parsing CSV like this is not perfectly safe. Using $csv->getline () is not only much safer, but also solves your question instantly:
open my $fh, "<", $csv_filename or die "Cannot open file \"$csv_filena +me\": $!\n"; while (my $row = $csv->getline ($fh)) { $d_array[++$line_number] = $row; # or even nicer # push @d_array, $row; } $csv->eof or $csv->error_diag (); close $fh or die "Cannot open file \"$csv_filename\": $!\n";
See how elegant and short?
|
|---|