my %hash = (one => 1, two => 2, three => 3); my @keys = qw(four five six); my @slice = @hash{@keys}; #### if (grep { exists %hash{$_} } @keys) { print "yep\n"; } else { print "nope\n"; }