for (0..$#array) { if (foo($array[$_])) { splice @array, $_, 0; # remove it. } else { print "$array[$_] returned false\n"; next; } other_stuff(); }