##
my $sort_by_numeric_value = sub {
my $hash = shift;
sort {$hash->{$b} <=> $hash->{$a}} keys %$hash ;
};
####
tie my %sorted_ages, 'Tie::Hash::Sorted',
'Hash' => \ %ages,
'Sort_Routine' => $sort_by_numeric_value;
####
for my $name ( keys %sorted_ages ) {
print "$name is $sorted_ages{$name} years old.\n";
}