in reply to Difference my and local
example2 will print the $x that is local to example, but the global $y.use strict; use warnings; our ($x, $y) = ('global X', 'global Y'); example(); sub example { local $x; my $y; $x = 'changed local'; $y = 'changed my'; example2(); } sub example2 { print "X: $x, Y: $y\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Difference my and local
by strat (Canon) on May 25, 2005 at 07:01 UTC |