in reply to Re: sorting a hash
in thread sorting a hash

You don't need to make a list of the records. Just sort the keys ...

You cannot "just sort the keys", without making a list of them!

Since the record-hash might become quite large ...

There is not a

way to sort the records in place or other ways to minimize copying- operations.

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco.
Rule 1 has a caveat! -- Who broke the cabal?

Replies are listed 'Best First'.
Re^3: sorting a hash
by tlm (Prior) on Mar 26, 2005 at 15:06 UTC

    My interpretation of the OP's question was that the records were much larger than the keys, and making a separate sorted list of the records would require copying a lot of bytes. Sorting the keys still requires "making a list of them", i.e. copying, the number of bytes copied would be much smaller.

    Did I miss something?

    the lowliest monk

      Thanks a lot to everyone. Especially the links were helpful.

      It looks like I have to do as much copying operations as I expected.
      But the hints you gave me give my code more perlish elegance.

      Pustular Postulant is right, the records are much larger than the keys - but rethinking it - the records are just stored as pointers in a hash of hashes. So copying them won't hurt that much