in reply to Using Text::CSV

If reading from a stream, please forget about parse () and fields (). The two are combined a lot faster and more efficient into getline () when working in streams.

open my $fh, "<", "file.csv" or die "file.csv: $!\n"; while (my $row = $csv->getline ($fh)) { $row->[8] =~ m/criterium/ or next; # do something with this line } $csv->eof or $csv->error_diag ();

Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^2: Using Text::CSV
by ikegami (Patriarch) on Sep 24, 2009 at 15:45 UTC
    I think that snippet (and one for ouput) should be added to the top of the Synopsis, if not replace the current content of the Synopsis.

      The example is already in the docs since ages, and has been moved up to be the first in this diff in May. I don't know if that section could be even more clear than it already is.

      Note however that this is the documentation of Text::CSV_XS, and that this EXAMPLES section is not in the docs of Text::CSV.


      Enjoy, Have FUN! H.Merijn
        I said Synopsis.
A reply falls below the community's threshold of quality. You may see it by logging in.