in reply to How to invoke the method dynamically using universal::can

Note that can makes no sense for function calls. It checks inheritance. For functions, you should use something like the following:

sub call_function { my $funcname = shift; my $package = caller(); my $qfuncname = "${package}::$funcname"; no strict 'refs'; exists(&$qfuncname) or die("no such function $qfuncname\n"); return &{$qfuncname}(@_); } sub f { print "f\n"; } call_function('f'); call_function('g');
f no such function main::g