Take the 2-minute tour ×  It seems that Perl can only have
strings as the keys of a hash. (Has this been changed in a
certain version of Perl?) It is very limiting to only be able to
use strings as the key. What if I wanted an object or an array
to be the key? In Python it is easy to use an array, tuple, and
other objects that can compare, as dict keys. Perl does have the
ability to compare things like arrays for equality, so I don't
see why they can't be used as mapping-type keys.  Isn't there a
way to use any key type in Perl? Is there a module that provides
this?  share|improve this question add comment  4 Answers  Yes
it does, use fieldhashes (Hash::Util::FieldHash for 5.10+ and
Hash::Util::FieldHash::Compat for before 5.10) to register your
hashes as fieldhashes, and you can use any reference (and thus,
any object) as a key for those hashes (it numifies the
reference, essentially, and provides logic for dealing with
CLONEing across threads and garbage collecting the keys), for
example:  use Hash::Util qw