foreach (sort { $hash{$a} <=> $hash{$b} || $a cmp +$b } (keys %hash) )