in reply to i thought i knew 'our'...
'our' does _not_ declare a lexical scoped variable!
What 'our' does is to say that the variables _name_ shall
be lexical scoped. so:
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";
- being told that it's actually ok (using 'our' or 'use vars')
- you fully qualify its name, as in $main::foo
Autark.
In Section
Seekers of Perl Wisdom