my @out = ([grep !exists $h2{$_}, @array1]); #### my @out = (grep !exists $h2{$_}, @array1);