in reply to Switch the odd/even elements of an array
use xor on the array indexes:
Outputsmy @foo = (1..8); my @bar = @foo[map {$_ ^ 1} (0..$#foo)]; print "@bar";
- Miller2 1 4 3 6 5 8 7
In Section
Seekers of Perl Wisdom