![]() |
|
There's more than one way to do things | |
PerlMonks |
Re^2: Grep and AoH referencesby de-merphq (Beadle) |
on Dec 30, 2004 at 16:49 UTC ( #418312=note: print w/replies, xml ) | Need Help?? |
Actually grep want a list following its first argument. The reason the code doesnt throw a wobbly is that a reference to an array is a list of one element (the reference). By dereferencing $AoHref you get a different list, that being the contents of the array. A subtle but important distinction (that lots of folks around here love to harp on about, like me :-) Also the code as posted is wrong. Grep returns a list, so if you assign to a scalar like you are you get the count of objects that passed the filter test, not the list of objects. The code should look like my @grepped=grep ...
--- alter ego of demerphq
In Section
Seekers of Perl Wisdom
|
|