Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2016-09-29 19:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (560 votes). Check out past polls.