Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Counting Hash values?

by Kenosis (Priest)
on Mar 12, 2013 at 18:19 UTC ( #1023031=note: print w/ replies, xml ) Need Help??


in reply to Counting Hash values?

One more option:

use warnings; use strict; use Data::Dumper; my %hash; my %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', ); /(.+?)\|(.+)/ and push @{$hash{$2}}, $1 for values %data; print Dumper \%hash;

Partial output:

$VAR1 = { 'FLOWER|11+' => [ '15037' ], 'RED DOOR|10-14' => [ '1049', '5030', '959', '4990', '5565', '1065', '4449', ...


Comment on Re: Counting Hash values?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2014-12-29 02:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (184 votes), past polls