sorting hash

Posted on 2001-08-11
Last Modified: 2010-03-05
I have a hash like this:


I have to sort it by value.


Then I have to print the keys.
Question by:superquestions
  • 2

Expert Comment

by:christopher sagayam
ID: 6376199
foreach $key(sort {$allurls{$a} <=> $allurls{$b}} keys %links)


Accepted Solution

christopher sagayam earned 50 total points
ID: 6376200
oops it should be

foreach $key(sort {$links{$a} <=> $links{$b}} keys %links)


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Perl 101 11 72
how to exit a  for loop inside a function with return value in bash 5 96
Writing a parser for java language 4 71
Ned Perl Snippet to Read Files in Directory 5 62
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now