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>
Beast [ Fr, 22 Juli 2005 13:08 ] [ ID #891116 ]

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>
cclarkson [ Fr, 22 Juli 2005 13:40 ] [ ID #891117 ]

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>
japhy [ Fr, 22 Juli 2005 13:42 ] [ ID #891118 ]
Perl » gmane.comp.lang.perl.beginners » pointer

Vorheriges Thema: RE: Replacing printf by print
Nächstes Thema: A little Object Question