Your skill will accomplish what the force of many cannot |
|
PerlMonks |
(take two...) Re: A split ing headacheby mwp (Hermit) |
on Dec 12, 2000 at 12:28 UTC ( [id://46234]=note: print w/replies, xml ) | Need Help?? |
As my esteemed colleagues have pointed
out, the LIMIT argument for split doesn't truncate
tokens whose indices are greater than LIMIT, merely lumps
them together as the last return value. Think of it like
this: split EXPR on PATTERN into a list LIMIT elements
long.
If you want to actually truncate the leftover list elements, try this:</o>
And 'code' just goes away. Just watch your parens, because this is wrong: split(':', $string)[0..2]Hopefully you can see why.
In Section
Seekers of Perl Wisdom
|
|