[plug] Perl Query...

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


Ok, so not strictly Linux-related, but I thought I'd try here before battling
wider-scale groups. ^_^

Are there any Perl Guru's extraordinaire on this list? I'm trying to figure out
how to call a subroutine in a Perl module, where the name of the routine is
arbitary and stored as a string in a scalar.

eg; If I have a variable bink which has the value bill ($bink = "bill"), such
that I want to call subroutine bill using bink in module Fred, how would I do
it??

More to the point, how do I do it elegantly? ^_^
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...

Any ideas??

If not, can anyone reccommend other public forums where queries like this are
fielded?

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