Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: CSV Parser, with and without encapsulation

by Tux (Monsignor)
on Oct 25, 2012 at 08:14 UTC ( #1000785=note: print w/ replies, xml ) Need Help??


in reply to CSV Parser, with and without encapsulation

The "best" is of course Text::CSV_XS :)

Text::CSV is just a wrapper over Text::CSV_XS and/or Text::CSV_PP.

If your CSV data is mixed and invalid, chances are that you might not find a combination of options that will work on all records, but a good start for what you describe would be something like:

my $csv = Text::CSV_XS->new ({ binary => 1, allow_loose_quotes => 1, escape_char => undef, auto_diag => 1, });

Please carefully read the manual for all allow_*** options.


Enjoy, Have FUN! H.Merijn


Comment on Re: CSV Parser, with and without encapsulation
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (15)
As of 2015-07-02 13:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (40 votes), past polls