in reply to Re^3: Hash value interpolation
in thread Hash value interpolation

The problem can be avoided by calling keys before each.
keys %$ht; # Reset iterator while (my ($key, $value) = each(%$ht)) {

Update: Checked source to make sure it's efficient. Yes it is. It doesn't enumerate the keys at all in void context.