Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
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 avoiding work at the Monastery: (7)
As of 2014-12-29 06:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (184 votes), past polls