Fellow Monasterians,
I had no problem grepping a straight AoH, but I can't figure out how to do it with references. Googled and Supersearched to little avail (learned lots of other stuff, though ;^). What am I not getting?
my $AoHref = [ { name => "barney", age => "43" }, { name => "fred", age => "44" }, { name => "wilma", age => "42" } ]; my $newAoH = grep { !($_->{'name'} eq "fred") } $AoHref; print Dumper ($newAoH);
I'm sure the problem is in how I dereference in the grep statement. Tried things like:
my $newAoH = grep { !({$_->{'name'}} eq "fred") } $AoHref;
...but nada. Thanks.
In reply to Grep and AoH references by bradcathey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |