On Wed, Jan 29, 2003 at 12:40:21PM -0500, Aaron Sherman wrote:

> Elements of a has ARE ordered, just not the way you may expect.

Quite:

$ perl5.8.0 -le '%a = (small => 1, large =>2); %b = %a; print foreach keys %a; print 
"--"; print foreach keys %b'
large
small
--
small
large

$ perl5.8.0 -le '%a = (small => 1, large =>2); print foreach keys %a; print "--"; @a = 
(0..1e3); $a{$_}=1 foreach @a; delete $a{$_} foreach @a; print foreach keys %a'
large
small
--
small
large

> There is no problem. It will pop the Pair that would be last if you
> converted to a list. That might be massively expensive to determine, but
> as long as the documentation warns the same way it does for converting
> to a list, then you're not causing any new problems.
> 
> You keep asserting that there's  no ordering to Hashes, but that's not
> true. I don't blame you, even the Perl docs get it wrong sometimes.

And the demonstration was as expected?

(I don't know two strings that clash for the hash algorithms used in 5.6 and
in 5.005 and earlier, hence why I'm specifying 5.8.0
pie => 1 , good => 1  works for the first example in 5.8.0 and 5.6.1,
perl => 1, rules => 1 for the second in both)

Nicholas Clark

Reply via email to