for (reverse 0..$#array) { splice @array, $_, 1 if $array[$_] == $whatever; }