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 reply to Re^3: map split vs array split
by FunkyMonk
in thread map split vs array split
by convenientstore
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |