Enjoy_Life wrote:
hi.
Hello,
i found typeglob and symbol table is quite difficult for me.
so i want someone to help me on it.
Get in your time machine and travel back 15 years when typeglobs and the
symbol table were relevant. There is little documentation for these
things as modern versions of Perl don't rely on them as much as
Perl3/Perl4 did.
see the code below:
$foo = "Some value";
*foo{PACKAGE}; #(1)
*{*foo}{PACKAGE}; #(2)
$ perl -le'$foo = "Some value"; *bar = *foo; print $bar; use
Data::Dumper; print Dumper *bar{PACKAGE}'
Some value
$VAR1 = 'main';
$ perl -le'$foo = "Some value"; *bar = *foo; print $bar; use
Data::Dumper; print Dumper *bar{SCALAR}'
Some value
$VAR1 = \'Some value';
$ perl -le'$foo = "Some value"; *bar = *foo; print $bar; use
Data::Dumper; print Dumper *{*{*{*{*bar}}}}{PACKAGE}'
Some value
$VAR1 = 'main';
$ perl -le'$foo = "Some value"; *bar = *foo; print $bar; use
Data::Dumper; print Dumper *{*{*{*{*bar}}}}{SCALAR}'
Some value
$VAR1 = \'Some value';
why the value of (1) and (2) are equal?
Because that is the way they work.
does that means foo is equals to *foo?
foo is a bareword that could be either a subroutine name or a filehandle
or a directory handle or a format name or a label name or a text string,
depending on context.
*foo is a typeglob that represents any variable type in the current package.
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/