P is for Practical | |
PerlMonks |
Re: Filter array of hashes for specific keysby Athanasius (Archbishop) |
on Oct 22, 2016 at 03:12 UTC ( [id://1174486]=note: print w/replies, xml ) | Need Help?? |
Hello ddominnik, Say I have an array of hashes like this: Actually, what you show is an array of arrays of hashes; the array @response has only one element, an anonymous array containing two hashes. If you really just want an array of hashes (AoH), use parentheses (round brackets) instead of square brackets at the top level:
See perlreftut and perldsc. BTW, note that the “fat comma” operator => stringifies its left operand,1 so in this case you don’t have to explicitly quote the key names. 1 “...if it begins with a letter or underscore and is composed only of letters, digits and underscores.” (perlop#Comma-Operator) Hope that helps,
In Section
Seekers of Perl Wisdom
|
|