The method for merging hashes that was introduced in Perl 5.18+ by randomizing hash orders?

According to the answer to this question, merging two hashes in Perl 5 can be done either with:

%newHash = (%hash1, %hash2); %hash1 = %newHash; 

or

 @hash1{keys %hash2} = values %hash2; 

Perl 5.18 , on the other hand, will implement hash process randomization .

Would the second method still be correct to use in Perl 5.18?

+8
merge perl hash
source share
1 answer

After reading Re ^ 2: the hash order randomization is on, are you ready? The answer is yes . As before, keys , values and each will cause the same sequence, repeated through a hash inside the same process, if the hash does not change between them.

+15
source share

All Articles