for my $i ( reverse 0 .. $#a ) { splice( @a, $i, 1 ) if should_delete; }