foreach $key (sort keys %h) { print "$key: $h{$key}\n"; } #### print map "$_: $h{$_}\n", sort keys %h;