in reply to sorting a hash

Not sure about what your hash looks like, but sorting a hash is as easy as:
by value:
$yourHashName{$b} <=> $yourHashName{$a};

or by the key of your hash:
foreach $key (sort (keys(%yourHashName))) { print "\t\t$key \t $yourHashName{$key}\n"; }

"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.