for my $k (sort keys %hash) { print "$k $hash{$k}\n"; }