in reply to i thought i knew 'our'...
says that you are allowed to use the name '$y' in the block. Its name is lexical scoped. It does enter the name $y into the stash. Now, as you have discovered, without strict you may access $y's value. So, how to do it with strict on ?use strict; { our $y = 17; print "inner: $y\n"; } print "outer: $y\n";
strict don't let you use globals (variables that live in the symbol table) unless:use strict; { our $y = 17; print "inner: $y\n"; } print "outer: $main::y\n";
Autark.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: i thought i knew 'our'...
by jlistf (Monk) on Jul 24, 2000 at 20:47 UTC | |
by autark (Friar) on Jul 24, 2000 at 21:03 UTC |