Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Parsing a file with multiple delimeters

by diotalevi (Canon)
on Jan 06, 2006 at 21:59 UTC ( [id://521654]=note: print w/replies, xml ) Need Help??


in reply to Parsing a file with multiple delimeters

It appears like that's a pipe delimited file with three columns, one of which happens to be internally delimited by commas. Use Text::CSV_XS.

use Text::CSV_XS; my $csv = Text::CSV_XS->new( sep_char => '|' ); while ( <> ) { $csv->parse( $_ ); my ( $file, $file_list, $yes_no ) = $csv->fields; print "$_ $yes_no\n" for $file, split /,/, $file_list; }

⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-18 03:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found