in reply to Twice the pleasure of sorting a hash

I used: sort {$saved_key{$b} <=> $saved_key{$a} || $a cmp $b} The first term returns zero if the values are the same (note the numeric compare, the string compare does not provide the sort show in the example). This in turn triggers the text compare on the keys. Worked for me.