in reply to Changing a returned hashref
The problem is this piece of code:
sub two{ $_[0]->{HASH} = {1 => 'one'}; }
It doesn't modify the hash that $_[0]{HASH} points to, but rather stores a new reference in there. Modifying the existing hash works:
sub two{ $_[0]->{HASH}{1} = 'one'; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Changing a returned hashref
by cqd (Initiate) on Nov 09, 2011 at 10:14 UTC | |
|
Re^2: Changing a returned hashref
by cqd (Initiate) on Nov 09, 2011 at 12:23 UTC | |
by Anonymous Monk on Nov 09, 2011 at 12:28 UTC | |
by cqd (Initiate) on Nov 09, 2011 at 13:48 UTC | |
by aaron_baugher (Curate) on Nov 09, 2011 at 14:25 UTC |