Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: How to map function name to coderef?

by ikegami (Patriarch)
on Jan 07, 2012 at 00:39 UTC ( [id://946690]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to map function name to coderef?
in thread How to map function name to coderef?

Yes, there are ways of fooling strict. It's simpler and clearer to just turn it off in the code in question.

my $func_name = 'f'; my $cr = do { no strict 'refs'; \&$func_name }; say $cr->();

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (2)
As of 2024-04-19 19:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found