Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: inverting hash / grouping values

by LanX (Canon)
on Sep 27, 2013 at 15:13 UTC ( #1055998=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      DB<100> use Hash::MoreUtils qw/safe_reverse/
    
    ...
    
      DB<106> safe_reverse \%h
     => (1, ["a", "b"], 2, "c")
    
  2. or download this
      DB<110> safe_reverse sub { my ($k, $v, $r) = @_; return [ @{$r->{$v}
    +}, $k ] },\%h
     => (1, ["a", "b"], 2, ["c"])
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2014-07-14 01:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (254 votes), past polls