I want to push a reference to a hash. By that I mean I want to push a reference to a new hash that is a shallow copy of the hash I am given.
How do I create the shallow copy?
I want to push a reference to a hash. By that I mean I want to push a reference to a new hash that is a shallow copy of the hash I am given.
How do I create the shallow copy?
Just copy it:
my %copy = %$hash;
If you want another reference, just expand the original reference in the anonymous hash constructor:
my $copy = { %$hash };