my $x = 'Foo'; my $sub_ref = do { no strict 'refs'; \&{$x}; };
Update: It appears my $sub_ref = \&{'Foo'}; passes strict when &{'Foo'}; does not. Huh?my $x = 'Foo'; my $sub_ref = \&{$x};
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
In reply to Re: Sub ref from string without eval
by kennethk
in thread Sub ref from string without eval
by lackita
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |