my (%hash, @new_array); @hash{@numbers} = @values; @new_array = grep {exists $hash{$_}} @array; print @new_array;