On Aug 2, James Edward Gray II said:
>I'm still a little confused about why that works. Is it because after
>the subroutine is "exported" it's called from inside the same namespace
>as the hash and can manipulate it at will? Or am I just lost (quite
>possible)?
When you export a hash, you're not copying it, you're aliasing it.
%main::hash is not a COPY of %MyExporter::hash, but an alias to it. The
exporting procedure is:
my $pkg = caller; # who is exporting us?
*{ $pkg . '::hash' } = \%hash;
That's basically what happens.
--
Jeff "japhy" Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ % -- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>