[Chicago-talk] Simple csv text parsing question

Mike Ferrari mikeferrari8 at yahoo.com
Wed Apr 9 11:44:46 PDT 2008


Hi
I know this sounds simple, but this is the first time i have run into it and
am spending more time than i would like trying to figure it out.

I have a .csv file (all great stories start with either "I had this .csv
file".. or .. "dude, hold my beer") and it follows the usual csv norm.. i am
working on a winxp box and my output will eventually be another .csv file
read by excel on another xp box.

data,"data","data with a comma,data",normal data,"and data"

It just so happens that some of the data has a CRLF smack in the middle

I am using Text::CSV for the first time and am liking the power to deal with
the commas and quotes and stuff.. but i am having problems with the CRLF in
the middle of the data.

The perldoc page says if you run into non ASCII characters use binary mode..
but the CRLF isn't non ASCII.

Whats the most normal/easiest way to deal with CRLF in the data without
screwing up the normal end of line? I need to sanitize the data somehow and
am drawing a blank.

I have been searching online for something but am coming up without any good
meat.

Thanks a billion.
Mike

-- 
/dev/mike0

http://www.mikeferrari.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20080409/957db6df/attachment.html 


More information about the Chicago-talk mailing list