in reply to sort hashes....

You ought to get the camel book. Basic programming concepts such as sorting are explained in depth there.
Anyway, the code is @sorted = sort { $hash{$a}->[2] <=> $hash{$b}->[2] } keys hash;.
Hope that helped.