Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: hash of hashes

by NetWallah (Abbot)
on Oct 06, 2013 at 05:13 UTC ( #1057115=note: print w/replies, xml ) Need Help??


in reply to hash of hashes

This is probably what you are looking for:
use strict; my %byColor; while (<DATA>){ my ($fruit, @colors) = split; for my $c(@colors){ push @{ $byColor{$c} }, $fruit; } } for my $c(sort keys %byColor){ print "$c\t @{$byColor{$c}}\n"; } __DATA__ strawberry red green rose apple red rose mango green
Output:
green strawberry mango red strawberry apple rose strawberry apple

             My goal ... to kill off the slow brain cells that are holding me back from synergizing my knowledge of vertically integrated mobile platforms in local cloud-based content management system datafication.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1057115]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2016-12-07 23:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (133 votes). Check out past polls.