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

Re: Comparison of the parsing features of CSV (and xSV) modules

by Tux (Canon)
on May 08, 2007 at 13:37 UTC ( [id://614137]=note: print w/replies, xml ) Need Help??


in reply to Comparison of the parsing features of CSV (and xSV) modules

Just for the record, Text::CSV_XS does know the difference between NULL/undef and empty strings. This will show when using always_quote => 1:

   my $csv = Text::CSV_XS->new ({ always_quote => 1});
   $csv->combine ("", 1, undef, "bar");
   print $csv->string, "\r\n";

Will result in:

   "","1",,"bar"

Note the missing quotes for the undef entry

If requested, I can consider adding an option to do the reverse also: when always_quoted is true, return empty columns as undef in the $csv->fields call.


Enjoy, Have FUN! H.Merijn

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-20 14:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found