You want to call a subroutine by the name in a variable, which is disallowed by strict 'refs'. One of the values of strictness is that if strictness is turned off in one part of some code that is otherwise compliant, it is a useful warning to the reader that dangerous stuff is happening here - rather than hide it, highlight it:
for my $subname (@list) { # we have to turn off strict 'refs' here because ... # but it is safe to do so because ... no strict 'refs'; $subname->($subname); }
Hugo
In reply to Re: Canon concerning coderef calls?
by hv
in thread Canon concerning coderef calls?
by jobi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |