in reply to sort question

if you already have a list of the keys of the middle hash (A,B,C), then you can do this:
my @listofkeys = ('A','B','C'); @sortedlistofkeys = sort { $entry{$table}{$a}{RANK} <=> $entry{$table{ +$b}{RANK} } @listofkeys;
Update:
Got beaten to the punch, and dragonchild had a better answer, too! ack!