Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re^2: how to push 5th element from one array to another arrayby gmargo (Hermit) |
on Oct 28, 2009 at 02:29 UTC ( [id://803560]=note: print w/replies, xml ) | Need Help?? |
Your code: adds a fraction (4/5) to the last array index. So adding appropriate parentheses: seems better but it does not work for all array lengths. (It works if the length modulo 5 is 0 or 1 only.) Changing the 4 to a 1 (aka the array length) does the trick:
In Section
Seekers of Perl Wisdom
|
|