in reply to Re: Modifying values by reference: what works and what doesn't
in thread Modifying values by reference: what works and what doesn't
This code shows that you were not that precise :-) (Update: See below reply from phaylon, sounds like I have misunderstood what he said, and that was my fault. I up voted both of his posts.)
use strict; use warnings; my $ref = {"a" => 1}; print $ref, "\n"; foo($ref); sub foo { my $ref = shift; print $ref, "\n"; $ref = { "all" => "new" }; print $ref, "\n"; }
Run it, you will see that the first two print statements print the same addresses, but not the third one.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Modifying values by reference: what works and what doesn't
by phaylon (Curate) on Aug 25, 2005 at 21:03 UTC |