Isn't the stuff in brackets an anonymous hash? Isn't the ordering of hashes strictly not guaranteed by default?use constant {continue=>0, next=>1, redo=>2, last=>3 };
So how could that work, since the numbers and the labels in the hash, it would seem, should end up in a random order?
I know the following would fail (because the RHS of the 'our $clist' won't be done at compile time):
But how is it that this seems to always work:our $clist = {continue=>0, next=>1, redo=>2, last=>3 }; use constant $clist;
Is it that compile-time hashes are not randomized? Never really thought about it before, but I guess they can't be?#(Using): alias tperl='perl -we'\''use strict; use P;' > tperl our $clist; use mem($clist = {continue=>0, next=>1, redo=>2, last=>3 }); use constant $clist; P "redo=%s, last=%s", &redo, &last;' redo=2, last=3
In reply to Curious: are anon-hashes in random order? by perl-diddler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |