Jeff Pang wrote:
> hello,list,
Hello,
> See these commands pls:
>
> [EMAIL PROTECTED] coremail]$ perl -le 'our %test = (type => "software");
> print $::{test}'
> *main::test
You are printing the value for the key 'test' in the hash %:: (the symbol
table; see the "Symbol Tables" section of perlmod.)
> [EMAIL PROTECTED] coremail]$ perl -le 'our %test = (type => "software");
> print ${*main::test{HASH}}{type}'
> software
*main::test{HASH} returns a hash reference to the 'test' symbol table entry
(see part 7 of the "Making References" section of perlref.)
> [EMAIL PROTECTED] coremail]$ perl -le 'our %test = (type => "software");
> print ${$::{test}{HASH}}{type}'
> [ no output ]
You are trying to print $::{test}->{HASH}->{type} but $::{test} does not
contain a hash reference.
> The first command prove that " $::{test} == *main::test ";
> The second command access the GLOB *main::test and get the value 'software'
> in hash %test.
>
> My question is:
> why I get nothing via accessing the $::{test} which is equl to *main::test in
> the third command?Thanks.
%:: is the symbol table in the package 'main', *main::test is the type glob
'test' in the package 'main'. You are dealing with two different variables.
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>