pointer
I found this code on some script :
*test = \&show;
What is "*" means? Isn't that reference/pointer is using "\" symbol?
--
--beast
--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>
RE: pointer
Beast <mailto:beast [at] 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
--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>
Re: pointer
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 [at] 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
--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>