Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: How do I parse a CSV that can contain newlines in fields?

by ChOas (Curate)
on Apr 03, 2001 at 14:24 UTC ( [id://69258]=note: print w/replies, xml ) Need Help??


in reply to How do I parse a CSV that can contain newlines in fields?

Hey

Set your input line seperator ($/) to the line
delimiter, and then split on your field delimiter..

Or use supersplit


GreetZ!,
    ChOas

print "profeth still\n" if /bird|devil/;
  • Comment on Re: How do I parse a CSV that can contain newlines in fields?

Replies are listed 'Best First'.
Re: Re: How do I parse a CSV that can contain newlines in fields?
by jorg (Friar) on Apr 03, 2001 at 14:45 UTC
    Have a look at Text::CSV

    Jorg

    "Do or do not, there is no try" -- Yoda
      To elaborate: Text::CSV can do CSV parsing, but you'll need to make sure you send it the appropriate fields (using the input separator above, or whatever trick you prefer). Another piece of advice about Text::CSV: The docs mention that a certain range of characters is allowed. If a character outside that range is in the data, it will quietly not work.

        You must put Text::CSV in binary mode:

        my $csv = Text::CSV->new( {binary => 1, eol = $/ } );

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-04-19 07:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found