I guess, your confusion comes from the presence of GLOB slot in the symbol
table entry described in the book. In reality, the syntax *{"color"}
references the symbol table entry as a whole, not the GLOB slot of it. When
you assign some reference to this entry, then perl copies the reference into
appropriate slot of the symbol table (type of reference defines which slot is
taken).
The GLOB slot of symbol table entry mentioned in the perlref is something
obscure. It is not reported by the Devel::Peek module. I guess, that this is
just a syntax sugar. One can do either $a = \*other; or $a = *other{GLOB};
and both shall return the reference to the symbol entry as a whole. This
reference can be used for reading files and doing something like *{$$a} = \$b;
to alias $other with $b.
Reference to the symbol entry is not the same as an "alias" for the symbol entry.
You can do $a = *other; here $a shall become alias of the symbol entry and you can
say ${$a}[0] = 2; or ${$a}{key} = 3; or <$a> to read the file. All of this
will actually use @other or %other etc. Effectively, it is an alternative to
using references.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|