in reply to Re^3: Time to seconds
in thread Time to seconds

Actually, it is not just "some historical versions" of Perl: it is one of the most important properties of hashes that the order of pairs they hold is (for all intents and purposes) random. Most importantly, adding a single pair to a hash may lead to getting the pairs back in an entirely different order. This order is of course not actually random: it's deterministic if you know the hash lookup function. That however may change between different versions and ports of Perl; if nothing else, then this alone means scripts have no business assuming anything about it.

Replies are listed 'Best First'.
Re: Re: Re^3: Time to seconds
by John M. Dlugosz (Monsignor) on Nov 16, 2001 at 03:40 UTC
    I saw a sorted hash pm somewhere, either in the examples for tie or maybe in Conway's book.
      That would be implemented as a tied hash which only looks like a one, but really is an object.
        Correct.

        It contains a list, where it notes the desired ordering, and a hash, where it really stores everything. If memory serves, the object was an array of two elements, presented as a pseudohash.

        --John