Thanks for Adriano Ferreira.Your explaination is good for me.I have known
that.

On 12/7/05, Adriano Ferreira <[EMAIL PROTECTED]> wrote:
>
> On 12/5/05, Jennifer Garner <[EMAIL PROTECTED]> wrote:
> > As we know, $::{sym} == *main::sym, it's a typeglob.
> > but what is **main::sym? and the same,what is *{$glob}?thanks.
>
> **main::sym is a syntax error, but *{*main::sym}==*main::sym.
>
> But don't be fooled by the equality $::{sym} == *main::sym. It just
> means they numerically compare the same. Taking references you get
> that $::{sym} returns a scalar and *main::sym a glob.
>
> $ perl -e 'print \($::sym, *main::sym)'
> SCALAR(0x1002f094)GLOB(0x10010fa8)
>
> So *{$glob} is the way to tell Perl to go from the scalar to the glob,
> when we'll be able to access its HASH part.
>
> That's why
>
> $ perl -e 'our %sym = (name => "flower"); print
> ${*{$::{sym}}{HASH}}{name};"
>
> prints "flower", but
>
> $ perl -e 'our %sym = (name => "flower"); print ${$::{sym}{HASH}}{name};"
>
> prints nothing ($::{sym}{HASH} returns undef). As Wiggins wisely said,
> $sym->{name} is more sane.
>

Reply via email to