in reply to Re^2: alternate array elements
in thread alternate array elements

BTW: for one-liners you can use global vars like $a or $b without declaration, even when strict.

C:\>perl -e"print grep {++$a % 2} qw{a 1 b 2 c 3}" abc

Though their values will leak into the outer scope, so state is better for longer scripts.

FWIW: I always thought that an automatic loop-count variable $c or $^c would come very handy inside grep-like constructs.

Cheers Rolf
(addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
Wikisyntax for the Monastery