Syntactic Confectionery Delight | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Simply put, you can't split arrays. The purpose of split is to split a string into a list of values. Therefore, split expects a scalar as its second argument, representing the string to split. When you pass an array, the array is evaluated in scalar context, which returns the number of elements in the array. If you wanted to split each of the lines, you should use a foreach loop to iterate over the values in the array and operate on them one at a time:
Or, for another approach, you could use map:
In any case, split simply does not, will not work they way you're trying to use it -- it's not supposed to.
<–radiant.matrix–>
Ramblings and references The Code that can be seen is not the true Code I haven't found a problem yet that can't be solved by a well-placed trebuchet In reply to Re^3: map split vs array split
by radiantmatrix
|
|