in reply to Re: Re: Strange method behavior
in thread Strange method behavior
my %hash = (snark => 'snark'); # hash my $ref = \%hash; # ref to hash surprise($ref); # pass ref to hash sub surprise { my $ref = shift; # copy ref to hash $ref->{snark} = 'boojum'; # change ref'ed hash } print "snark => $hash{snark}\n"; # print original hash __END__ snark => boojum
|
|---|