in reply to Re: Confusion due to hash
in thread Confusion due to hash
Prints:use strict; use warnings; use Data::Dumper; my %input = (10=>1, 20=>2, 30=>1, 40=>2); my %output; map { $output{ $input{ $_ } } += $_ } keys %input; %output = reverse %output; print Dumper \%output;
Update: I paid to much attention to the requested output, and not enough to the note that he couldn't reverse the hash$VAR1 = { '60' => '2', '40' => '1' };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Confusion due to hash
by GrandFather (Saint) on Jan 31, 2006 at 01:51 UTC |