in reply to Re^2: subroutine refs
in thread subroutine refs
Removing the intermediate assignment to $name, broquaint’s code simplifies to:
use strict; my $subref = \&{'dynamic'}; &$subref(); sub dynamic { print "Mmm, dynamic.\n"; }
which is explicitly documented as an exception to the normal behaviour of strict 'refs' (see strict):
There is one exception to this rule:
$bar = \&{'foo'}; &$bar;is allowed so that goto &$AUTOLOAD would not break under stricture.
So, yes, this is canonical.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|