Paul wrote:

> 
> Lexicals aren't in the symbol table.
> 
>   my $foo;
> 
> *can't* be accessed as $pack::foo, because it isn't IN a package.
> 

true.

> Locals, on the otherhand, *have* to be package variables that can be
> tracked by $pack::foo syntax. So how can
> 
>   my @bar;
> 
> allow
> 
>   local $bar[2];
> 
> to localize an element of @bar which isn't traceable through a package
> name? It obviously works, but I don't see *how*.
> 

there is no package variables in Perl, only global or lexical. local doesn't 
work on what you refer to as package or my-variable. it works on the stack. 
all variables are on the stack whether it's global or lexical (there are 
different stack for different thing of course). local localizes the 
variable(puts it on the stack), the value is pop off the stack after the 
block exit(no matter how it exit) so the original value is retain. that's 
*how* :-)

david

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to