Home > Archive > PERL Beginners > July 2005 > pointer
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
|
I found this code on some script :
*test = \&show;
What is "*" means? Isn't that reference/pointer is using "\" symbol?
--
--beast
| |
| Jeff 'japhy' Pinyan 2005-07-24, 8:29 pm |
| On Jul 22, Beast said:
> I found this code on some script :
>
> *test = \&show;
>
> What is "*" means? Isn't that reference/pointer is using "\" symbol?
*foo is a typeglob. It's a way of representing everything named "foo":
the scalar $foo, the array @foo, the hash %foo, the subroutine &foo, the
filehandle foo, the dirhandle foo, the format name foo...
Assigning a reference to a typeglob means that the particular compartment
of the glob (in the case above, the function compartment of the glob) is
an alias to that which was referred to.
*test = \&show;
means that &test is an alias for &show -- calling the test() function is
the same as calling the show() function.
For more on typeglobs, see 'perldoc perldata'.
--
Jeff "japhy" Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ % -- Meister Eckhart
| |
| Charles K. Clarkson 2005-07-24, 8:29 pm |
| Beast <mailto:beast@i6x.org> wrote:
: I found this code on some script :
:
: *test = \&show;
:
: What is "*" means? Isn't that reference/pointer is using "\" symbol?
Read the Typeglobs and Filehandles section of the 'perldata' file
for details.
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
|
|
|
|
|