Welcome to the Monastery | |
PerlMonks |
Re: variable subroutine callby pfaut (Priest) |
on Dec 12, 2007 at 01:24 UTC ( [id://656530]=note: print w/replies, xml ) | Need Help?? |
You can use a variable containing the name of a function as a reference to call the function.
Although Perl supports this, you shouldn't use it because it can be very dangerous. This is disallowed when 'use strict refs' is in effect. meraxes solution is better. Store references to allowed functions in a hash and allow the user to choose a function by entering its key value.
In Section
Seekers of Perl Wisdom
|
|