-my @sorted = { $tmp{$a} <=> $tmp{$b} or $a cmp $b } keys %tmp; +my @sorted = sort { $tmp{$a} <=> $tmp{$b} or $a cmp $b } keys %tmp;