Help for this page

Select Code to Download


  1. or download this
    sub num_or_str {
        no warnings 'numeric'; 
    ...
                $people{$a}->{age}, 
                $people{$b}->{age} 
             ), keys %people;
    
  2. or download this
    my @stuff = qw/ 9 -1 -3 hi 0 bye 5 10 /;
    
    ...
    else {
           @ar = sort { num_or_str($a, $b) } @stuff;
    }
    
  3. or download this
    my $sort_by = 'age';
    my $descending = 1;
    ...
            return sort { your_conditions( $a, $b)} keys %$people;
        }
    }
    
  4. or download this
    my @sorted_keys = sort_people( \%people, $sort_on, $descending);