you can do it using eval to return the coderef, as follows:
use strict; use warnings; sub some_sub { "hello\n"; } my $sub_name = 'some_sub'; my $coderef = eval("\\&$sub_name"); print &$coderef();
In reply to Re: How to map function name to coderef?
by bluescreen
in thread How to map function name to coderef?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |