Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Play golf on an array of hashrefs

by Joost (Canon)
on Jun 10, 2002 at 15:36 UTC ( [id://173197]=note: print w/replies, xml ) Need Help??


in reply to Play golf on an array of hashrefs

@array = map { exists $_->{mykey} ? $_->{mykey} : () } @array;
Update: this also checks for existence of the key, if you don't need to, go for Abigail's solution.
-- Joost downtime n. The period during which a system is error-free and immune from user input.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-20 01:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found