Another way to do it:
$ perl -le' use List::MoreUtils "natatime"; my @x = "a" .. "z"; my $iter = natatime 2, @x; my @even; while ( my @y = $iter->() ) { push @even, $y[ 0 ]; } print "@even"; ' a c e g i k m o q s u w y
In reply to Re: alternate array elements
by jwkrahn
in thread alternate array elements
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |