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

Kevin D. Clark kclark at CetaceanNetworks.com
Thu Jan 2 14:27:22 CST 2003


"Black, Franklin" <fblack at docucorp.com> writes:

> 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.

Try something like this:

    #!/bin/perl

    sub foo { print "foo\n" }

    sub bar { my $func = shift; &$func }

    bar(\&foo);

Regards,

--kevin
-- 
``It's a bivouac, man.  They sleep here.''
      - Perfect Tommy




More information about the Nh-pm mailing list