in reply to Re: Taking reference to function
in thread Taking reference to function
can returns a code ref so you don't need to turn off strictures, just:
use strict; use warnings; my $funcName = 'doit'; if (my $cando = main->can ($funcName)) { $cando-> (); } sub doit { print "I done it\n"; }
Prints:
I done it
|
|---|