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 ...
In reply to Re^2: Grep and AoH references
by de-merphq
in thread Grep and AoH references
by bradcathey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |