$a=1; my @result = grep { $a = not $a }, @input;