Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Creating sub from string without munging the symbol table

by choroba (Cardinal)
on Jun 22, 2015 at 16:18 UTC ( [id://1131489]=note: print w/replies, xml ) Need Help??


in reply to Creating sub from string without munging the symbol table

You can always use eval, but I don't think it's any better.
for my $member (@constants){ my $thing; eval "sub $member" . '{ $thing = @_ ? shift : $thing }'; }
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-04-24 20:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found