for( $i = 0; $i < @array; $i++){ if( $array[$i] == $look ) { @out = (@array[0..($i-1)], @array[($i+1)..scalar(@array)], $array[$i]); last; } }