There's more than one way to do things | |
PerlMonks |
Peculiar hash behaviorby dd-b (Monk) |
on Oct 02, 2021 at 03:23 UTC ( [id://11137191]=perlquestion: print w/replies, xml ) | Need Help?? |
dd-b has asked for the wisdom of the Perl Monks concerning the following question: Hashes are defined to take string keys (though...stringification can make that work for random objects sometimes depending on what you expect of the value later; for just finding the object, and if the default stringification is unique among all such objects, it works). I tried a weird thing, using lists as a hash key, and got remarkable results; Data::Dumper is claiming my hash has 3 members with the same key! It was just playing around, and I don't see any important use for it (if I did, I'd need to understand it enough to really believe in it!; now I'm just a little curious). This code:
Produces this output:
(I observed this with perl 5, version 32, subversion 1 (v5.32.1) built for amd64-freebsd-thread-multi; I believe it's the default FreeBSD binary currently. So not an obscure environment.)
Back to
Seekers of Perl Wisdom
|
|