Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Perl: How to sort hash by value

Perl: How to sort hash by value

#!/usr/bin/perl -w
my% myCities = ("Germany" => "Berlin"
     "England" => "London"
     "France" => 'Paris');
 # sort Hash values
foreach $elem (sort { $myCities{$a} cmp $myCities{$b} }
                keys %myCities)
    print "$myCities{$elem} => $elem.

Users who found this page were searching for:

  • hash sorting in python
  • perl hash sorting by value
  • hash + "/usr/bin/perl"
  • python hash sort
  • perl sort hash
  • java: calculate the crc checksum of a file
  • how to center string output java
  • python get working directory
  • crc checksum program in java
  • Perl Sort Hash by Value

No comments yet.

Leave a Comment