Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: subroutine refs

by Athanasius (Archbishop)
on Sep 15, 2013 at 06:45 UTC ( [id://1054162]=note: print w/replies, xml ) Need Help??


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,

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1054162]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2024-03-28 10:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found