Welcome to the Monastery | |
PerlMonks |
Re^2: extracting elements by key from an array of hashesby Athanasius (Archbishop) |
on Sep 25, 2015 at 13:25 UTC ( [id://1143013]=note: print w/replies, xml ) | Need Help?? |
Hello Discipulus, grep defined, map {$_->{'k2'}} @aoh; This works well as long as the hash value is itself defined. But if the hash entry exists with a value of undef:
then the result of the grep will be indistinguishable from the case in which the hash entry does not exist at all. The following does distinguish between these two cases:
Hope that helps,
In Section
Seekers of Perl Wisdom
|
|