in reply to Changing key values, i.e. renumbering keys?

If your keys are numbers, have you considered using an array instead?

  • Comment on Re: Changing key values, i.e. renumbering keys?

Replies are listed 'Best First'.
Re^2: Changing key values, i.e. renumbering keys?
by Fletch (Bishop) on Jan 20, 2008 at 16:11 UTC

    I think what Corion is implying is that since you're squashing the second level keys to sequential indexen you could just keep them in an arrayref instead of a hash, and the element index would be the ID naturally (which makes sense; you'd just build a new parallel copy by walking over each sub-hash's values sorted by the key and push them into the new array).

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.