sotona has asked for the wisdom of the Perl Monks concerning the following question:
I can search through it:my @array = ( {x => 1, y => 2, z => 3}, {x => 4, y => 5, z => 6}, #etc );
but how do I store the entire hash with matching key?grep {$_->{x} == 4 } @array;
my @newarray = grep {$_->{x} == 4 } @array;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Search through array of hashrefs and store matching
by ww (Archbishop) on Jan 23, 2015 at 16:52 UTC | |
by sotona (Scribe) on Jan 23, 2015 at 17:18 UTC | |
by AnomalousMonk (Archbishop) on Jan 23, 2015 at 19:03 UTC | |
by Laurent_R (Canon) on Jan 23, 2015 at 19:53 UTC |