in reply to alternate array elements
my @all = qw(zero wun two tree fower fife six seven ait niner); my @evens = @all[grep {not $_ % 2} 0..$#all];
but (being a hash) the items must be unique, and you loose the original order. If the other values are required (offsets 1,3,5,7) then use values instead of keys.my @evens = keys %{{@all}};
|
|---|