Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Using Text::CSV

by Tux (Canon)
on Sep 24, 2009 at 12:34 UTC ( [id://797186]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://797186]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2026-04-11 21:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.