Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: How to map function name to coderef?

by AnomalousMonk (Abbot)
on Jan 07, 2012 at 00:59 UTC ( #946692=note: print w/ replies, xml ) Need Help??


in reply to How to map function name to coderef?

... what I would really like is to map a string to the code reference of the function itself ...

If you mean an arbitrary string, the following is one way.

>perl -wMstrict -le "my %f_map = ( glue => \&foo, ); ;; print $f_map{glue}->('hoo'); ;; sub foo { return 'FOO' . $_[0]; } " FOOhoo


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://946692]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2014-12-21 20:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (107 votes), past polls