in reply to Re^2: How to sort Hashes of Hashes and print results in a file
in thread How to sort Hashes of Hashes and print results in a file

If you want to sort "numbers" instead of "strings" for the first level keys of the hash, then replace
foreach my $k1 (sort keys %hash){
with
foreach my $k1 (sort {$a <=> $b} keys %hash){