while ( -1 < ( $i = firstidx { $_ == $val } @array ) ) { ... } #### for (0 .. $#array) { next if $_ != $var; ... }