--- Elizabeth Mattijsen <[EMAIL PROTECTED]> wrote:
> At 03:52 PM 3/14/01 -0800, Paul wrote:
> But nothing about the structural/algorithmic mechanics. :<
>
> From the perlsub docs:
>
> Variables declared with my are not part of any package and are
> therefore
> never fully qualified with the package name. In particular, you're
> not
> allowed to try to make a package variable (or other global) lexical:
>
> my $pack::var; # ERROR! Illegal syntax
> my $_; # also illegal (currently)
> In fact, a dynamic variable (also known as package or global
> variables) are
> still accessible using the fully qualified :: notation even while a
> lexical
> of the same name is also visible:
>
> package main;
> local $x = 10;
> my $x = 20;
> print "$x and $::x\n";
> That will print out 20 and 10.
>
> There is _no_ stash of lexicals during execution, only during
> compilation. I guess one of the reasons lexicals are faster.
>
>
> Elizabeth Mattijsen
An excellent example, all known and understood.
What I can't find is this:
I know that my($x) puts x on this scope's scratchpad (and not in any
package space), but rather than a hash named main:: with a key named x
(which is, as I understand it, an oversimplification perhaps, but
basically what Perl does internally for $main::x), exactly *how* does
Perl "put" x into the scratchpad AV*? and once it's there, what did it
store? How does it know that entry is 'x'? is it just a reference to
the actual value?
None of this is critical for anything I'm doing right now, but I'm a
detail hound. I want to *understand* it, so that in the future I can
make intelligent decisions about what would be a "better" way to write
any given algorithm, without just relying on popular wisdom and "urban
legend". =o)
(That's why I said it was Very[OT], lol....)
Paul
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices.
http://auctions.yahoo.com/