Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: CSV headers. Feedback wanted

by Tux (Canon)
on Feb 13, 2016 at 20:58 UTC ( [id://1155177]=note: print w/replies, xml ) Need Help??


in reply to Re: CSV headers. Feedback wanted
in thread CSV headers. Feedback wanted

The default low-level mode is iterative!

The new csv function by default is pulling all data into memory, but by using a filter you can prevent that. The documentation shows examples.

Iterative (straight from the docs):

use Text::CSV_XS; my $csv = Text::CSV_XS->new ({ binary => 1, auto_diag => 1 }); open my $fh, "<", "file.csv" or die "file.csv: $!"; while (my $row = $csv->getline ($fh)) { # do something with @$row } close $fh or die "file.csv: $!";

Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^3: CSV headers. Feedback wanted
by Laurent_R (Canon) on Feb 14, 2016 at 09:53 UTC
    Really? Strange, I can swear that I tried it for at least a full day and it failed miserably each time the file was really large. I guess I must have used it wrongly then, possibly I used an example that was not adequate for my needs, but it's too long ago for me to remember the exact details.

    Well, thank you and thans to AnonyMonk for the information, I'll look at it again. And... sorry for the disruption with apparently inaccurate information.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2026-05-14 04:46 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.