Outputsmy @foo = (1..8); my @bar = @foo[map {$_ ^ 1} (0..$#foo)]; print "@bar";
- Miller2 1 4 3 6 5 8 7
In reply to Re: Switch the odd/even elements of an array
by wind
in thread Switch the odd/even elements of an array
by jaredor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |