in reply to alternate array elements
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: alternate array elements
by Anonymous Monk on May 20, 2010 at 15:14 UTC | |
by Anonymous Monk on May 20, 2010 at 15:17 UTC |