in reply to Explanation of warning created when over using "my"
use strict; use warnings; my $a = 1; # a simple variable my $ref_a = \$a; # refers to the original $a my $a = 5; # obscures the old $a, but # ref_a still points to the old $a print "'a' = $a; 'ref_a' points to ", ${$ref_a}, "\n";
Now of course you see what to expect, but in a larger program this behaviour can leave you puzzled. You should of course have created a new variable instead.
|
|---|