Adriano Ferreira wrote:
> On 12/5/05, Jennifer Garner <[EMAIL PROTECTED]> wrote:
>
>>print ${*{$::{sym}}{HASH}}{name};
>
>
>>How to analyse the last sentence of that code?Thanks.
>
>
>>From "perldoc perlref"
>
> 7. A reference can be created by using a special syntax, lovingly
> known as the *foo{THING} syntax. *foo{THING} returns a reference
> to the THING slot in *foo (which is the symbol table entry which
> holds everything known as foo).
>
> $scalarref = *foo{SCALAR};
> $arrayref = *ARGV{ARRAY};
> $hashref = *ENV{HASH};
> $coderef = *handler{CODE};
> $ioref = *STDIN{IO};
> $globref = *foo{GLOB};
>
> So $::{sym} returns the glob symbol "sym" on the main package ($main::
> or $::), takes a reference to its HASH part, and returns what it got
> in the key "name". Piece of cake, ain't it?
>
> Regards,
> Adriano.
>
Now that you understand it, replace it with $sym->{name} so the next
person doesn't have to ask. Unless you are using a really old Perl.
http://danconia.org
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>