Please send questions to st10@humboldt.edu .
#!/usr/bin/perl -w

#######################################################
# lect08_sort_hash_values
#
# simple example sorting hash contents by hash VALUES
#
# modified by Sharon Tuttle from "Learning Perl",
#    by Schartz and Phoenix
#
# last modified: 10-11-04
#######################################################

my %score = ( "barney" => 195,
              "fred"   => 205,
              "dino"   => 30 
            );               

my @winners = sort { $score{$b} <=> $score{$a} } keys %score;
my $player;

print "\n";
foreach (@winners)
{
    $player = $_;

    printf "%-8s %5d\n", $player, $score{$player};
}
print "\n";

# end of lect08_sort_hash_values