Think about Loose Coupling | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hi Monks, What is a simple way to execute a string as a Perl command, in a Perl script? For example, let's say I have a scalar assignment like this: $cmd = '$var1 = 5;';If I want to execute $cmd, ending up with $var1 containing 5, what's an easy way to do it, (without parsing the string, picking out the variable & value, and making the assignment with an indirect reference). I've looked at 'eval', and other posts here, but can't find anything appropriate yet. Thanks. In reply to Executing a string as a Perl command by tel2
|
|