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.
|
---|
In Section
Seekers of Perl Wisdom