in reply to Re: Global destruction feature / bug ?
in thread Global destruction feature / bug ?
our is not supposed to be a global(ly visible) variable and hence should be reclaimed at the same time as my $foo
I have to disagree. our creates a lexical alias for the global variable (stored in the symbol table).
The alias isn't globally visible, but there's still a global variable behind it. This is how it should be. Consider this:use Devel::Peek; our $foo; Dump $foo; Dump $main::foo; __END__ SV = NULL(0x0) at 0x24bfdc4 REFCNT = 1 FLAGS = () SV = NULL(0x0) at 0x24bfdc4 REFCNT = 1 FLAGS = ()
use strict; { our $foo = 'foo'; our $bar = 'bar'; } { our $foo; print $foo; print $main::bar; } __END__ foobar
lodin
|
---|
In Section
Seekers of Perl Wisdom