in reply to Use a hashref as a key in another hashref?
That's a classic! :)
Hash-keys are always stringified and there is no "direct" way to dereference the stringification.
BUT you are free to keep the original ref somewhere. Either as value in your data-structure or in a separate hash with $ref_of_str{"$key_hash"}=$key_hash. ¹
Thats much safer BTW cause a string doesn't increment the reference count ... i.e. keeping the reference somewhere protects the data from destruction if ref-count reaches 0.
(I hope it's clear now why dereferencing a string will hardly be ever possible)
HTH! :)
Cheers Rolf
(addicted to the Perl Programming Language)
¹) I rarely come into situations where I really need this trick. I'm sure your data-structure could be rewritten to avoid this, but tl;dr...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Use a hashref as a key in another hashref?
by tobyink (Canon) on Jun 05, 2014 at 08:42 UTC | |
by LanX (Saint) on Jun 05, 2014 at 10:21 UTC | |
|
Re^2: Use a hashref as a key in another hashref?
by mwb613 (Beadle) on Jun 05, 2014 at 07:49 UTC | |
by Anonymous Monk on Jun 05, 2014 at 07:59 UTC |