diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2003-06-27 08:54:16 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-06-27 08:54:16 +0000 |
commit | 7b3f70378c41657f3e0c917f322e2cda58f33b5e (patch) | |
tree | eee620b91b1cb28b9acb8af4b04569ec7f34dbda /pod/perlsec.pod | |
parent | bf1e01904b621fce6a1d1e1bcf187334cf1b1e04 (diff) | |
download | perl-7b3f70378c41657f3e0c917f322e2cda58f33b5e.tar.gz |
Some warnings about the (im)proper uses of the hash randomisation.
p4raw-id: //depot/perl@19866
Diffstat (limited to 'pod/perlsec.pod')
-rw-r--r-- | pod/perlsec.pod | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/pod/perlsec.pod b/pod/perlsec.pod index 92853dde1c..41f96691ac 100644 --- a/pod/perlsec.pod +++ b/pod/perlsec.pod @@ -417,6 +417,19 @@ consecutive runs of Perl will order hash keys differently, which may confuse some applications (like Data::Dumper: the outputs of two different runs are no more identical). +B<Perl has never guaranteed any ordering of the hash keys>, and the +ordering has already changed several times during the lifetime of +Perl 5. Also, the ordering of hash keys has always been, and +continues to be, affected by the insertion order. + +Also note that while the order of the hash elements might be +randomised, this "pseudoordering" should B<not> be used for +applications like shuffling a list randomly (use List::Util::shuffle() +for that, see L<List::Util>, a standard core module since Perl 5.8.0; +or the CPAN module Algorithm::Numerical::Shuffle), or for generating +permutations (use e.g. the CPAN modules Algorithm::Permute or +Algorithm::FastPermute), or for any cryptographic applications. + =item * Regular expressions - Perl's regular expression engine is so called |