Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: Text CSV_XS memory crash

by spazm (Monk)
on Feb 02, 2011 at 18:40 UTC ( #885820=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Text CSV_XS memory crash
in thread Text CSV_XS memory crash

Tux, thanks for replying to my post and reviewing my code!

  1. Yes, good point, no need to explicitly include use Text::CSV
  2. Because I don't want bound vars, I want a hashref. I use the hash for readability of the data and code for this test example.
  3. True, comma is the default. Leftover from modifying the original code. I'll clean that up.
  4. auto_diag sounds like a useful change for both scripts (mine and original poster's).
changes applied.


Comment on Re^3: Text CSV_XS memory crash
Select or Download Code
Re^4: Text CSV_XS memory crash
by Tux (Monsignor) on Feb 02, 2011 at 23:17 UTC

    2. You can still have a hashref:

    my $csv = Text::CSV_XS->new ({ binary => 1, auto_diag => 1 }); open my $fh2, "<:encoding(utf8)", $file or die "$file: $!"; my $columns = $csv->getline ($fh2); for (@$columns) { s/^\s+//; s/\s+$//; } my %row; $csv->bind_columns (\@row{@$columns}); while ($csv->getline ($fh2)) { process_row (\%row); }

    Enjoy, Have FUN! H.Merijn
      thanks

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2014-09-20 05:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (153 votes), past polls