in reply to Re: re-key a hash
in thread re-key a hash

You are explicitly allowed to delete each element as you iterate; you ought not to make other changes (as this code does).

Replies are listed 'Best First'.
Re^3: re-key a hash
by Roy Johnson (Monsignor) on Aug 03, 2004 at 01:27 UTC
    I can understand the caveat if you're iterating over values or with each, but sort keys is not a hash iterator.

    We're not really tightening our belts, it just feels that way because we're getting fatter.
      You're right; I misread the loop. There's no problem at all, then, except that the code doesn't do what he wants.