- or download this
my %sortfkt = (
"item" => \&numerical,
...
"age" => \&numerical,
"height" => \&numerical,
);
- or download this
sub string {
return $_[0] cmp $_[1];
...
sub numerical {
return $_[0] <=> $_[1];
}
- or download this
sort { &{$sortfkt{$orderby}}($hash{$a}{$orderby}, $hash{$b}{$orderby})
+ } keys %hash
- or download this
#!/usr/bin/perl
...
sub numerical {
return $_[0] <=> $_[1];
}