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;
On the other hand, Perl 5.18 will introduce per process hash randomization.
Will the second method still be correct to use in Perl 5.18?
After reading through Re^2: Hash order randomization is coming, are you ready?, the answer is yes. As before, keys
, values
and each
will produce the same sequence iterating through the hash inside the same process if the hash isn't changed in between.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With