$ perl -Mstrict -Mwarnings -E ' > my @x = (0 .. 10); > my @y = grep { state $z = 0; $_ == 3 and $z = 1; $z } @x; > say qq{@y}; > ' 3 4 5 6 7 8 9 10