in reply to Re: Removing extra blank lines
in thread Removing extra blank lines

except that the ordering stays the same provided the hash does not change
I wouldn't even rely on this. The current implementation does it this way, but there's no telling what could happen in the future. Hashes have no order whatsoever, and you shouldn't rely on the any side effects to get an order.

I could see perl going to some type of lazy, hash rebalancing structure. In this model, when cpu usage is low, it reoptimizes the hash. If this were the case, then the order might change, even though you do alter any elements in the hash.

Replies are listed 'Best First'.
Re: Re: Re: Removing extra blank lines
by Joost (Canon) on Jun 05, 2002 at 10:50 UTC
    It might change - but I suspect this will not happen before Perl6 arrives. The docs (or the camel book, I forget) explicitly say that the ONLY thing you can count on as far as hash-ordering goes, is that the ordering of keys, values and each on a hash will be identical. - The changes you suggest will break that.
    -- Joost downtime n. The period during which a system is error-free and immune from user input.