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
{filelink=14715}

#!/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:

  • perl "sort hash by value"
  • Perl Sort Hash by Value
  • crc checksum program in java
  • java: calculate the crc checksum of a file
  • python get working directory
  • hash sorting in python
  • perl sort hash
  • java label font underline
  • python sorting hash using values
  • python hash sort

No comments yet.

Leave a Comment