I don't know enough to say for sure, but when INIT is called, the pad accesses are probably all figured out. Then after INIT, it does whatever magic it does to give the appearence of a scope to a bare block. I would think that even though they are unavailable to the outer scope, their position is retained in the pad list. Otherwise the location of a my var would change from before and after the bare block.use warnings; use strict; INIT { use Data::Dumper; use PadWalker qw (peek_my peek_sub); print Dumper(peek_my(1)); } my $foo = 'lee'; my $bar = "Bar"; sub peeker{ print Dumper(peek_my(shift)); } print Dumper(peek_my(0)); { my @foo = (1..3) } { my @bar = (9..12); peeker(1); } print Dumper(peek_my(0)); __END__ $VAR1 = { '$foo' => \undef, '@foo' => [], '$bar' => \undef, '@bar' => [] }; $VAR1 = { '$foo' => \'lee', '$bar' => \'Bar' }; $VAR1 = { '$foo' => \'lee', '$bar' => \'Bar' }; $VAR1 = { '$foo' => \'lee', '$bar' => \'Bar' };
In reply to Re: Re^6: Lexical pad / attribute confusion
by shotgunefx
in thread Lexical pad / attribute confusion
by adrianh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |