in reply to Selecting a Specific Keys in Relation to a List

another approach is to use an intermediate hash and the  delete built-in.

C:\@Work\Perl>perl -wMstrict -e "my %h = qw(a 1 b 2 c 3 d 4); my @not_wanted = qw(b d); my %wanted = %h; delete @wanted{ @not_wanted }; print qq(key $_ => value $wanted{$_} \n) for keys %wanted" Outputs: key c => value 3 key a => value 1