Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^2: split every other valueby Aristotle (Chancellor) |
on Aug 07, 2004 at 00:32 UTC ( [id://380790]=note: print w/replies, xml ) | Need Help?? |
You got your odd/even mixed up. The first element is at index 0, which is even. Also, enter splice and statement modifiers.
It is worth noting that this would be buggy if the list could possibly have undefs in it (not the case here; but I'd put a comment to that effect in the code). Obscure trickery for the fun of reducing it further, but don't do this at home:
Makeshifts last the longest.
In Section
Seekers of Perl Wisdom
|
|