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

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

by tilly (Archbishop)
on Jun 18, 2004 at 02:01 UTC ( [id://367834]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Comparison of the parsing features of CSV (and xSV) modules
in thread Comparison of the parsing features of CSV (and xSV) modules

There are, of course, going to be boundary cases that don't work as expected as soon as you start playing with allowing undoubled double-quotes inside of a format that expects them doubled. However Text::xSV allows you to define arbitrary filters that it preprocesses text with, and should do a reasonable job on the above with the following filter:
sub { my $line = shift; $line =~ s/\r$//; $line =~ s/"(.)/""$1/g; $line =~ s/"?,"?/,/g; return $line; }
Yes, there is some fragility, but it should be at least moderately hard to trigger.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-25 09:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found