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

Re: Re: ignoring empty returns from split

by sachmet (Scribe)
on Apr 24, 2001 at 04:11 UTC ( [id://74917]=note: print w/replies, xml ) Need Help??


in reply to Re: ignoring empty returns from split
in thread ignoring empty returns from split

That fails on the case where $line starts with a =:
$line = "==one==two==three"; ($one,$two,$three,$four)=split (/=+/,$line); print "$one\n$two\n$three\n$four";
gives me an undef, 'one', and 'two'.

As a side note, '$line' != '$a' :-)

Afterthought: This would work:
$line = "==one==two==three=four"; ($one,$two,$three,$four)=split (/=+/,($line=~/^=*(.*?)$/,$1)[1]); print "$one\n$two\n$three\n$four";

Log In?
Username:
Password:

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

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

    No recent polls found