my $sub_name = 'this'; my $x = do { no strict 'refs'; \&$sub_name }; print $x->(), "\n"; sub this { return "hi"; }
Note that I kept the scope small in which I used the no strict "refs"; to prevent damage from unwanted symbolic dereferentition.
In reply to Re: variable reference to subroutine while "strict"
by moritz
in thread variable reference to subroutine while "strict"
by halfcountplus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |