Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
    print "Unsorted:\n" ,Dumper \%hash;
    print "==========\n";
    print "Sorted:\n", map "$_, $hash{$_}\n", sort {$hash{$a} cmp $hash{$b
    +}} keys %hash;
    
  2. or download this
    $ perl sort_hash.pl
    Unsorted:
    ...
    John Hill, CA
    Ted McCain, TX
    John Evans, WI