Use the each() function (see perlfunc/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.