"my" variable $x masks earlier declaration in same scope at 585826.pl
+line 4.
"my" variable $x masks earlier declaration in same scope at 585826.pl
+line 6.
print __LINE__ . ": " . \$x . " = $x \n";
my $x = 123;
print __LINE__ . ": " . \$x . " = $x \n";
my $x = 456;
print __LINE__ . ": " . \$x . " = $x \n";
my $x;
print __LINE__ . ": " . \$x . " = $x \n";
1: SCALAR(0x0225fc4) =
3: SCALAR(0x022603c) = 123
5: SCALAR(0x1830b1c) = 456
7: SCALAR(0x1830ba0) =
(Undefined warnings omitted.)
Note that my $x does not always create a new variable. In my snippet, $x, $y and $z are the same variable every pass through the loop.
|