in reply to Re: Setting lexicals in a BEGIN block.
in thread Setting lexicals in a BEGIN block.
Variables declared with 'our' are lexically scoped:
Only their declaration is lexically scoped. The variable itself is a real global.
Only "my" variables are real lexicals:use strict; use warnings; { our $foo = "Hello, world!\n"; } { print our $foo; # prints: Hello, world! }
use strict; use warnings; { my $foo = "Hello, world!\n"; } { print my $foo; # warns: Use of uninitialized value }
- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.
|
---|