undef @h{<$FA>}; # store the "good" ones delete @h{<$QA>}; # remove the "bad" ones @output = keys %h; # keep the remaining ones