walkingthecow has asked for the wisdom of the Perl Monks concerning the following question:
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.my @results = grep { grep { $_ =~ /(?=.*cat)(?=.*dog)/i } values %$_ } + @{ $lines };
Both solutions worked, though I am going with the first one.grep { grep /cat/, grep /dog/, values %h } grep { grep /cat/, values %$_ } grep { grep /dog/, values %$_ } @aoh
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Checking a hash for two matching values.
by moritz (Cardinal) on Sep 17, 2013 at 04:34 UTC | |
|
Re: Checking a hash for two matching values.
by kcott (Archbishop) on Sep 17, 2013 at 04:39 UTC | |
by moritz (Cardinal) on Sep 17, 2013 at 05:54 UTC | |
by kcott (Archbishop) on Sep 18, 2013 at 01:02 UTC | |
|
Re: Checking a hash for two matching values.
by NetWallah (Canon) on Sep 17, 2013 at 05:07 UTC | |
by moritz (Cardinal) on Sep 17, 2013 at 05:51 UTC | |
by farang (Chaplain) on Sep 17, 2013 at 19:11 UTC | |
by NetWallah (Canon) on Sep 17, 2013 at 19:17 UTC |