each
function (see each) if you don't care whether it's sorted:
while (($key,$value) = each %hash) { print "$key = $value\n"; }
If you want it sorted, you'll have to use foreach
on the
result of sorting the keys as shown in an earlier question.
head2 What happens if I add or remove keys from a hash while iterating over it?
Don't do that.