The behavior is documented in perlsec Algorithmic attacks of complexity .
A hash is an array of linked lists. The hash function converts the key into a number, which is used as the index of the array element ("bucket") into which the value will be stored. More than one key can hash to the same index (โcollisionโ), a situation with which linked lists are associated.
If the attacker knew the hashing algorithm, he could develop values โโthat will hash with the same index, as a result of which the hash will degenerate in the linked list. This can lead to a huge performance hit in some applications and, therefore, can be used as part of a DoS (denial of service) attack.
Two measures are being taken to avoid this. One of them is to combine the hashing algorithm with randomization of the order in which the elements are stored, and the other complicates the detection of salt, disrupting the order in which the iterator visits the hash elements.
$ perl -E' my @k = "a".."z"; for (1..3) { my %h = map { $_ => 1 } @k; say keys %h; } ' iocmbygdkranwxfejuqpzvltsh bmcoigdywrankujfxezpqlvths juexfwarnkgdybmcoihstlvzpq
source share