my %hash; # use the hash like normal - perl will keep it in whatever # order is the most useful for the runtime foreach my $key (sort keys %hash) { print $hash{$key}; }