develooper Front page | perl.perl5.porters | Postings from March 2013

Perlfunc for each(), keys(), values() has been changed

Thread Next
March 29, 2013 11:39
Perlfunc for each(), keys(), values() has been changed
Message ID:
Each of the three functions entry in perlfunc now has the following paragraph:

+Hash entries are returned in an apparently random order.  The actual random
+order is specific to a given hash; the exact same series of operations
+on two hashes may result in a different order for each hash. Any insertion
+into the hash may change the order, as will any deletion, with the exception
+that the most recent key returned by C<each> or C<keys> may be deleted
+without changing the order. So long as a given hash is unmodified you may
+rely on C<keys>, C<values> and C<each> to repeatedly return the same order
+as each other. See L<perlsec/"Algorithmic Complexity Attacks"> for
+details on why hash order is randomized. Aside from the guarantees
+provided here the exact details of Perl's hash algorithm and the hash
+traversal order are subject to change in any release of Perl

And damn, I now notice a missing full stop on the last line. /grrr

I'll postpone fixing it for  awhile to see if there are any further
changes recommended by the list.


perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About