A while ago I had a similar problem, involving analysis of the perfomance of
football (soccer) players. Their performance stats were stored in a multilevel
hash, the final key of which was their name. I wanted a list of
the players in order of performance on a particular statistic, which is
similar you your situation. Here is a bit of the code i used.
@players; # list of names
@keys = sort {
$data{$half_query}{$stat_query}{$b} #compares on statistic
<=>
$data{$half_query}{$stat_query}{$a}
||
$a cmp $b # if they are equal compare on name
} @players;
Hope that helps!
Greg.