Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Odd workings of split

by morgon (Deacon)
on Mar 29, 2012 at 12:50 UTC ( #962377=note: print w/ replies, xml ) Need Help??


in reply to Odd workings of split

From "perldoc -f split":

Note that splitting an EXPR that evaluates to the empty string always returns the empty list.
So it's not split that returns an undef, but the first element of the empty list that split returns (which is what you want to use) is undef.

I guess if you want to pass on an empty string (as opposed to undef) in such cases you would have to add a clause such as

$cmd[$_] //= "";


Comment on Re: Odd workings of split
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2014-08-01 02:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (256 votes), past polls