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:
use Data::Dumper; my %h1; $h1{(1, 1)} = 17; $h1{(2, 2)} = 19; $h1{('', 22)} = 23; $h1{(22, '')} = 22; my @h = (3, 4, 5); $h1{(@h)} = 44; print Dumper(\%h1);
Produces this output:
$VAR1 = { '22' => 22, '22' => 23, '11' => 17, '3' => 44, '22' => 19 };
(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.)