my @found= grep { my %r = reverse map lc, %$_; exists $r{cat} && exists $r{dog} } @pets;