I know how to do a simple sort on hash values: @sorted = sort { $hashed{$a} <=> $hashed{$b} } keys %hashed; but I need need to have the keys also sorted in case of (and my application will have many) equal values. For example, $hashed{'a'} = 1; $hashed{'b'} = 3; $hashed{'c'} = 2; $hashed{'d'} = 2; $hashed{'e'} = 1; $hashed{'f'} = 2; I need to come up with (in a report): a 1 e 1 c 2 d 2 f 2 b 3 I imagine a simple way to do this exists. Thank you for your help.
In reply to Hash sort with equal values by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |