or download this
my %data = (bananas => 1,oranges => 7,apples => 12, mangoes => 3,pears
+ => 8,);
# Using <=> instead of cmp because of the numbers
foreach my $fruit (sort {$data{$a} <=> $data{$b}} keys %data) {
print $fruit . ": " . $data{$fruit} . "\n";
}