Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Grep and AoH references

by de-merphq (Beadle)
on Dec 30, 2004 at 16:49 UTC ( [id://418312]=note: print w/replies, xml ) Need Help??


in reply to Re: Grep and AoH references
in thread Grep and AoH references

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://418312]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-03-29 06:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found