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