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

Re: Access functions by name

by Your Mother (Archbishop)
on Jun 15, 2009 at 21:55 UTC ( #771809=note: print w/replies, xml ) Need Help??


in reply to Access functions by name

This is not meant as advice, just an option. The no strict refs approach JavaFan showed has always bothered me. This works without turning strict off. It has no other advantage I can think of though and might be harder to follow for some devs. Hence, not advice, just discussion.

use strict; my $func_ref = \&{'function1'}; $func_ref->( 1 .. 3 ); # Or... &$func_ref( 1 .. 3 ); sub function1{ print "I gots: ", join("+", @_), $/ }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://771809]
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: (5)
As of 2021-10-19 12:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (76 votes). Check out past polls.

    Notices?