in reply to hash dereferencing / copying
In order to copy more than one level of references, use Data::Dumper:my $this={name=>'alex',array=>['one','two']}; my $that={%$this}; $that->{name}='Ido'; print $this->{name}; #alex - not affected $that->{array}[0]='three'; print $this->{array}[0];#three - affected
use Data::Dumper; my $this={name=>'alex',array=>['one','two']}; my $that=eval Dumper $this; $that->{name}='Ido'; print $this->{name}; #alex - not affected $that->{array}[0]='three'; print $this->{array}[0];#one - not affected
|
|---|