in reply to Hash value, containing a reference to some value of hash, not the intended behaviour.

You need to do a deepcopy. Replace:
my %newhash = %hashcopy;
With something like this:
use Storable qw(dclone); my %newhash = %{dclone(%hashcopy)};
We could use thaw and freeze, but a simpler interface is provided in dclone which carries out both operations. There is also a Clone module on CPAN.
  • Comment on Re: Hash value, containing a reference to some value of hash, not the intended behaviour.
  • Select or Download Code