in reply to Sub ref from string without eval
If you know which package you expect your subroutine to be in you might also be able to use the functionality of UNIVERSAL::can
use strict; use warnings; sub Foo { warn 'foo'} my $x = 'Foo'; my $sub_ref = main->can($x); $sub_ref->();
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Sub ref from string without eval
by Rhandom (Curate) on Apr 03, 2012 at 13:38 UTC |
In Section
Seekers of Perl Wisdom