[plug] Perl Query...

Trevor Phillips phillips at central.murdoch.edu.au
Wed Jan 31 11:57:30 WST 2001


Christian wrote:
> 
> Basically if you have a scalar like $blink which is the name of a Perl
> subroutine that you want to call you can do it like this:
> 
> &$bink();
> 
> Obviously if its part of a module or whatever you'll need to adjust the
> syntax for this.  Also note that you can pass parameters into it the
> normal way via the parentheses.

I know this syntax. I just can't figure out how to apply it to calling a
subroutine in a module, rather than a straight/local subroutine call.

> > One way I've nutted out is like this:
> >   exec "Fred->$bink"
> > But that doesn't seem to be very efficient (using exec & all), and gets more
> > complex when you want to pass args to $bink...
> 
> Does that work?  Weird... I thought exec was just for executing new
> programs.

D'oh! Sorry. "eval", not "exec". ^_^;;

-- 
. Trevor Phillips             -           http://jurai.murdoch.edu.au/ . 
: CWIS Systems Administrator     -           T.Phillips at murdoch.edu.au : 
| IT Services                       -               Murdoch University | 
 >------------------- Member of the #SAS# & #CFC# --------------------<
| On nights such as this, evil deeds are done. And good deeds, of     /
| course. But mostly evil, on the whole.                             /
 \      -- (Terry Pratchett, Wyrd Sisters)                          /



More information about the plug mailing list