Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How to map function name to coderef?

by bluescreen (Friar)
on Jan 07, 2012 at 00:30 UTC ( #946687=note: print w/ replies, xml ) Need Help??


in reply to How to map function name to coderef?

you can do it using eval to return the coderef, as follows:

use strict; use warnings; sub some_sub { "hello\n"; } my $sub_name = 'some_sub'; my $coderef = eval("\\&$sub_name"); print &$coderef();


Comment on Re: How to map function name to coderef?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2015-08-05 01:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (76 votes), past polls