Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Issue parsing CSV into hashes?

by stephen (Priest)
on Sep 21, 2010 at 18:02 UTC ( #861127=note: print w/ replies, xml ) Need Help??


in reply to Issue parsing CSV into hashes?

The parse is failing because of the quotation marks. From the manual: "Fields that contain a special character (comma, newline, or double quote), must be enclosed in double quotes."

Change your initialization to:

my $csv = Text::CSV_XS->new( { 'allow_loose_quotes' => 1, } );
and it should parse.

Resetting 'sep_char' to ':' won't work, because that will make CSV split on ':' characters, and you want it to split on commas.

I suspect that for what you're doing, you're not actually getting any value from Text::CSV_XS. I think you'd do better just to use split(), but that's up to you.

stephen


Comment on Re: Issue parsing CSV into hashes?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2014-09-22 08:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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











    Results (185 votes), past polls