Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: to sort hash wrt values corresponding to keys

by ramprasad27 (Sexton)
on Nov 02, 2011 at 06:28 UTC ( #935308=note: print w/ replies, xml ) Need Help??


in reply to Re: to sort hash wrt values corresponding to keys
in thread to sort hash wrt values corresponding to keys

my %input_hash = (key1,2,key2,3,key3,1); code:

foreach (sort {$input_hash{$a} <=> $input_hash{$b}} keys %input_hash){ print "$input_hash{$_} \n"; }

if at all thats what you wanted.


Comment on Re^2: to sort hash wrt values corresponding to keys
Re^3: to sort hash wrt values corresponding to keys
by ansh batra (Friar) on Nov 02, 2011 at 06:36 UTC
    thanks ramprasad!!
    this would be enough for me

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (14)
As of 2015-07-07 15:51 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 (91 votes), past polls