if (grep { exists %hash{$_} } @keys) { print "yep\n"; } else { print "nope\n"; }