Help for this page

Select Code to Download


  1. or download this
    my $sort_by_numeric_value = sub {
        my $hash = shift;
    ...
    for my $name ( keys %sorted_ages ) {
       print "$name is $sorted_ages{$name} years old.\n";
    }
    
  2. or download this
    sub by_numeric_value {
        $ages{$b} <=> $ages{$a}
    ...
    for my $name (sort by_numeric_value keys %ages) {
        print "$name is $ages{$name} years old.\n";
    }