Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Parsing data that may or may not be CSV

by gav^ (Curate)
on Apr 19, 2002 at 03:10 UTC ( [id://160423]=note: print w/replies, xml ) Need Help??


in reply to Parsing data that may or may not be CSV

What about:
my $data = join '', <DATA>; $data =~ s/,/ /g; my @addresses = $data =~ /(\S+)/g; print join "\n", @addresses; __DATA__ foo@foo.com bar@bar.com, foo@foobar.com bar@foo.com , bar@foobar.com
This should work find as email addresses shouldn't contain a comma.

update: thanks to dws for suggesting to subsitute a space for a comma.

gav^

Replies are listed 'Best First'.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-25 05:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found