http://www.perlmonks.org?node_id=1054383

walkingthecow has asked for the wisdom of the Perl Monks concerning the following question:

I have an array of hashes, and I am trying to return from this array of hashes all hashes that contain two values, say cat and dog.
Here's the line I have:
my @results = grep { grep { $_ =~ /(?=.*cat)(?=.*dog)/i } values %$_ } + @{ $lines };
Now, I know for a fact that there are hashes in this array of hashes that contain both cat and dog, but for some reason nothing is being returned.

UPDATE: Thanks to help from tye in the Chatterbox, I have figured out what to do here. My goal was to translate from boolean (AND, OR, NOT) to Regex, then match that against the values in an AoHes. Here's how it worked:
grep { grep /cat/, grep /dog/, values %h } grep { grep /cat/, values %$_ } grep { grep /dog/, values %$_ } @aoh
Both solutions worked, though I am going with the first one.