in reply to Reading file into an array and working with it.

What I would do is use Text::CSV to do the actual parsing, then push each array returned as an array reference onto a master array of locations:
use Text::CSV; my @locations; my $csv = Text::CSV->new(); open (FILE, "locations.csv") or die "Couldn't open location file: $!"; while (<FILE>) { $csv->parse($_); push(@locations, [$csv->fields]); } close FILE;

Replies are listed 'Best First'.
RE: Re: Reading file into an array and working with it.
by davorg (Chancellor) on Jun 26, 2000 at 12:25 UTC

    Might be worth pointing out that on CPAN there is now a Text::CSV_XS which, as its name implies, does the parsing in C code. It is therefore much faster than the pure Perl implementation in Text::CSV.

    --
    <http://www.dave.org.uk>

    European Perl Conference - Sept 22/24 2000
    <http://www.yapc.org/Europe/>
      Hmm, I wonder if DBD::CSV could use it as a backend... and whether it would speed DBD:CSV up, because it is pretty slow.