in reply to Does hash contain minimum keys?

In this example %required doesn't need to be a hash, and since that's what you're checking against, that's what you should search. You could also use prototyping to avoid building a whole new hash each time, so we'd end up with something like:

sub test_it (\%) { my ($h) = @_; return (keys (%$h) >= @required && !grep { !defined($h->{$_}) } @required); # return true if the list of missing required keys is empty }