Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: execute a string as a function

by LanX (Chancellor)
on Oct 06, 2013 at 14:03 UTC ( #1057149=note: print w/replies, xml ) Need Help??


in reply to execute a string as a function

strange, nobody mentioned using OOP yet

DB<147> ;{ package tst; sub a { "A" }; sub b {"B"} } DB<148> map { tst->$_ } 'a','b','a' => ("A", "B", "A")

classes and objects are essentially dispatch tables and methods are strings!

( just be careful about $_[0] :)

Cheers Rolf

( addicted to the Perl Programming Language)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1057149]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2016-12-04 16:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (68 votes). Check out past polls.