for ( reverse(0..$#array) ) { if ( the_condition($array[$_]) ) { splice @array, $_, 1, the_sub($array[$_]) } }