Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
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 perusing the Monastery: (6)
As of 2014-10-01 01:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (386 votes), past polls