Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: map and grep (but for hashes) (List::Pairwise)

by lodin (Hermit)
on Jan 31, 2009 at 11:59 UTC ( #740410=note: print w/replies, xml ) Need Help??


in reply to map and grep (but for hashes)

Does the grepp and mapp functions in List::Pairwise do what you want? $a and $b is used for the keys and the values. The synopsis shows some simple examples.

I'm also a fan of using pair (from the same module) when suitable, and in particular when I need to sort the data. I often use a hash when I really want a list of tuples. pair gives me that and when I want to use e.g. grep I simply use $_->[0] for the key and $_->[1] for the value. No extra magic needed. If I want to turn it into a hash-like list I simply do map @$_, .... (Using pair can be excessively memory consuming though. mapp should not suffer from that.)

lodin

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (1)
As of 2022-01-19 05:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (55 votes). Check out past polls.

    Notices?