Don't ask to ask, just ask | |
PerlMonks |
Re: execute a string as a functionby Corion (Patriarch) |
on Aug 06, 2013 at 15:30 UTC ( [id://1048135]=note: print w/replies, xml ) | Need Help?? |
While what you describe is possible in principle through Perl built-ins, it's usually best to use the technique of a dispatch table:
The way you described directly would be through eval, but this approach has various pitfalls that the above code avoids.
In Section
Seekers of Perl Wisdom
|
|