in reply to sort direction
sub mysort { $hash{$a}{$orderby} <=> $hash{$b}{$orderby} or $hash{$a}{$orderby} cmp $hash{$b}{$orderby} } { local (*a, *b) = ($direction eq 'DESC') ? (\*b, \*a) : (\*a, \*b); foreach my $id (sort mysort keys %hash) { print "$id - $hash{$id}{$orderby}\n"; } }
|
|---|