produces the output:use Data::Dumper; print Dumper({ 1007 => "Hello", 1195 => "World", }); print Dumper({ 1195 => "World", 1007 => "Hello", });
The issue is that Data::Dumper just returns keys in the order that keys gave it, which returns keys that are in the same bucket in the insertion order. With a 2 key hash your odds of hitting this are 1/8. But when the hashing algorithm works right, a fixed portion of the keys wind up in a bucket with a neighbour. Therefore for larger hashes you are virtually guaranteed that the set of keys alone does not determine what order they come back in.$VAR1 = { 1195 => 'World', 1007 => 'Hello' }; $VAR1 = { 1007 => 'Hello', 1195 => 'World' };
If this explanation confuses, then Re (tilly) 4: Flip Flop III - Musical Buckets may help.
In reply to Re (tilly) 1: compare two hashes inefficiently.
by tilly
in thread compare two hashes inefficiently.
by deprecated
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |