Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: map split vs array split

by FunkyMonk (Chancellor)
on Jul 30, 2007 at 23:54 UTC ( #629702=note: print w/replies, xml ) Need Help??


in reply to Re^2: map split vs array split
in thread map split vs array split

Yet again, it's all about context:

my @lines1 = split(' ', @lines);

split expects a regexp and a string as arguments, which are both scalars. @lines is evaluated in scalar context, returning the number of elements it contains. So, split has nothing to split, and returns the number of elements to be assigned to @lines1.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2021-08-05 14:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My primary motivation for participating at PerlMonks is: (Choices in context)








    Results (44 votes). Check out past polls.

    Notices?