use Readonly; sub testvalue { Readonly my %hash => {h =>1}; return \%hash; } my $h = testvalue(); $h->{h} = 2;