in reply to How to convert Storable object back to a hash
To convert a hashref to a hash you can dereference it. e.g.:
my %hash1 = %{$href}; my %hash2 = %$href; my %subhash = %{$href->{subhash}};
If you are using a recent perl then you might also consider postfix dereferencing. No examples as I have not tried it yet (not for any particular reason).
And if you want an alias then use the refaliasing feature. This avoids making a copy of the hash (albeit a shallow one since perl copies the top level and keeps the inner references as-is).
use experimental qw /refaliasing/; \my %hash = $href;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to convert Storable object back to a hash
by tobyink (Canon) on Jun 21, 2023 at 05:48 UTC | |
by cavac (Prior) on Jun 26, 2023 at 09:21 UTC |