Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Can't Reference a Sub by Variable when using Strict

by broquaint (Abbot)
on Oct 04, 2004 at 07:41 UTC ( #396141=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Can't Reference a Sub by Variable when using Strict
in thread Can't Reference a Sub by Variable when using Strict

Creating symbolic references to subroutines is quite valid under strictures e.g

use strict; sub foo { print "It's all good."; } my $subref = \&{ "foo" }; &$subref; __output__ It's all good.
HTH

_________
broquaint


Comment on Re^3: Can't Reference a Sub by Variable when using Strict
Download Code
Re^4: Can't Reference a Sub by Variable when using Strict
by tachyon (Chancellor) on Oct 04, 2004 at 12:32 UTC

    That's a bug not a feature :-)

    C:\>perl -MO=Deparse test.pl sub foo { print q[It's all good.]; } my $subref = \&{'foo';}; &$subref;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2015-07-04 00:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls