lakshmikant has asked for the wisdom of the Perl Monks concerning the following question:
I want to print key and value pair as it is which in hash how to do that
my %hash = ( 4 => 20, 2 => 40, 3 => 30, 1 => 50, 5 => 10, ); while{ my $a = ((sort values %hash)); # key based on the second highest value my $b = ((sort { $hash{$b} <=> $hash{$a} } keys %hash)); print $b = $a; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to print key and value of hash as it is
by hippo (Archbishop) on Jun 03, 2016 at 08:14 UTC | |
|
Re: how to print key and value of hash as it is
by kzwix (Sexton) on Jun 03, 2016 at 08:46 UTC | |
|
Re: how to print key and value of hash as it is
by haukex (Archbishop) on Jun 03, 2016 at 08:20 UTC | |
|
Re: how to print key and value of hash as it is
by vinoth.ree (Monsignor) on Jun 03, 2016 at 07:48 UTC |