Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: grep keys in hash and retrieve values

by moritz (Cardinal)
on Mar 16, 2012 at 10:08 UTC ( [id://959952]=note: print w/replies, xml ) Need Help??


in reply to grep keys in hash and retrieve values

If you want the list of matches, use an array:

my @matches = grep /$regex/, keys %tax2loc

This puts grep into list context, thus returning a list of all matches (and not just the number of matches).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-03-28 11:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found