Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^4: undef vs empty string '' from split

by Sidhekin (Priest)
on Jun 21, 2007 at 05:32 UTC ( #622489=note: print w/ replies, xml ) Need Help??


in reply to Re^3: undef vs empty string '' from split
in thread undef vs empty string '' from split

split says:

When assigning to a list, if LIMIT is omitted, or zero, Perl supplies a LIMIT one larger than the number of variables in the list,

So while @arr = split gets a LIMIT of 0 (and stripping of trailing null fields), ($x, $y) = split gets a LIMIT of 3 (and no such stripping).

Another special case — potentially (as you, um, realized) surprising — but at least documented.

print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!


Comment on Re^4: undef vs empty string '' from split
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (14)
As of 2015-07-06 14:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (75 votes), past polls