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

Re: Counting Hash values?

by thundergnat (Deacon)
on Mar 12, 2013 at 17:38 UTC ( #1023025=note: print w/ replies, xml ) Need Help??


in reply to Counting Hash values?

Maybe something like:

use warnings; use strict; use Data::Dumper; my %hash = map { chomp; split ' => ', $_ } <DATA>; my %out; for (values %hash) { my ($val, $key) = split /\|/, $_, 2; push @{$out{$key}}, $val; } print Dumper \%out; __DATA__ 5030 => 5030|RED DOOR|10-14 1049 => 1049|RED DOOR|10-14 4990 => 4990|RED DOOR|10-14 959 => 959|RED DOOR|10-14 15047 => 15047|FLOWER|13+ 5565 => 5565|RED DOOR|10-14 4449 => 4449|RED DOOR|10-14 1065 => 1065|RED DOOR|10-14 2992 => 2992|RED DOOR|10-14 4956 => 4956|RED DOOR|10-14 17665 => 17665|FLOWER|13+ 6217 => 6217|RED DOOR|10-14 1224 => 1224|RED DOOR|10-14 424 => 424|RED DOOR|10-14 368 => 368|RED DOOR|10-14 451 => 451|RED DOOR|10-14 7752 => 7752|RED DOOR|10-14 4070 => 4070|RED DOOR|10-14 1312 => 1312|RED DOOR|10-14 17668 => 17668|FLOWER|13+ 4224 => 4224|RED DOOR|10-14 3588 => 3588|RED DOOR|10-14 11076 => 11076|RED DOOR|10-14 2986 => 2986|RED DOOR|10-14 2402 => 2402|RED DOOR|10-14 10834 => 10834|RED DOOR|10-14 849 => 849|RED DOOR|10-14 2954 => 2954|RED DOOR|10-14 11 => 11|RED DOOR|10-14 4093 => 4093|RED DOOR|10-14 492 => 492|RED DOOR|10-14 1861 => 1861|RED DOOR|10-14 4384 => 4384|RED DOOR|10-14 15037 => 15037|FLOWER|11+ 13044 => 13044|FLOWER|13+ 899 => 899|RED DOOR|10-14 292 => 292|RED DOOR|10-14 10421 => 10421|RED DOOR|10-14 4120 => 4120|RED DOOR|10-14 5557 => 5557|RED DOOR|10-14 3859 => 3859|RED DOOR|10-14 930 => 930|RED DOOR|10-14 649 => 649|RED DOOR|10-14 7511 => 7511|RED DOOR|10-14 648 => 648|RED DOOR|10-14 73 => 73|RED DOOR|10-14 12537 => 12537|RED DOOR|10-14 2485 => 2485|RED DOOR|10-14


Comment on Re: Counting Hash values?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2015-07-07 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls