[Nh-pm] RE: Nh-pm digest, Vol 1 #21 - 1 msg

Paul Lussier pll at lanminds.com
Thu Jan 2 14:18:09 CST 2003


In a message dated: Thu, 02 Jan 2003 13:55:57 CST
"Black, Franklin" said:

>Happy New Year!
>
>How do you use pointers to functions.
>I want to send the pointer as an argument to a sub routine, dereference it
>and call the function.

perldoc perlsub

Basically, it's the same as creating pointers to arrays or lists 
(note, this is referred to in perl parlance as 'a closure'):

	my $secret_version = '1.001-beta';
	my $secret_sub = sub { print $secret_version };
	&$secret_sub();

HTH,
-- 

Seeya,
Paul
--
Key fingerprint = 1660 FECC 5D21 D286 F853  E808 BB07 9239 53F1 28EE

	It may look like I'm just sitting here doing nothing,
   but I'm really actively waiting for all my problems to go away.

	 If you're not having fun, you're not doing it right!





More information about the Nh-pm mailing list