in reply to deep copy of hash of hash
my $y = {%x};
Although this does create a reference to a new anonymous hash and copies the key/value pairs (you can modify the keys of %$y without affecting the set of keys in %x), this is still not a deep copy - the values are still references to the same nested hashes ({'lastname' => 'michael','tel'=>'222'}) as in the original data structure.
For true deep copies, see e.g. dclone from Storable or Clone.
Minor improvements to wording.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: deep copy of hash of hash
by cmic (Acolyte) on May 27, 2019 at 09:25 UTC | |
by hippo (Archbishop) on May 27, 2019 at 10:07 UTC | |
by johngg (Canon) on May 27, 2019 at 09:34 UTC |