Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: Parsing data that may or may not be CSV

by BlueLines (Hermit)
on Apr 19, 2002 at 18:19 UTC ( [id://160623]=note: print w/replies, xml ) Need Help??


in reply to Re: Parsing data that may or may not be CSV
in thread Parsing data that may or may not be CSV

This doesn't work:
while ( <DATA> ) { push @addrs, split /(?:\s+,?\s*|,\s*)/, $_; } print Dumper \@addrs; __DATA__ foo@foo.com bar@bar.com, foo@foobar.com bar@foo.com , bar@foobar.com
produces the following output:
$VAR1 = [ '', 'foo@foo.com', 'bar@bar.com', 'foo@foobar.com', 'bar@foo.com', 'bar@foobar.com' ];
That empty entry at $addrs[0] is what I'm trying to avoid.

BlueLines

Disclaimer: This post may contain inaccurate information, be habit forming, cause atomic warfare between peaceful countries, speed up male pattern baldness, interfere with your cable reception, exile you from certain third world countries, ruin your marriage, and generally spoil your day. No batteries included, no strings attached, your mileage may vary.

Log In?
Username:
Password:

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

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

    No recent polls found