go ahead... be a heretic | |
PerlMonks |
Re^4: Executing a string as a Perl commandby ctilmes (Vicar) |
on May 16, 2011 at 10:48 UTC ( [id://905040]=note: print w/replies, xml ) | Need Help?? |
This short illustrative example has $cmd set inline, but in a real program, it could be constructed from other variables, it could be read from a user, it could be read from a file, etc.
The question was simply how to get it to execute once it was set. The answer is eval.
In Section
Seekers of Perl Wisdom
|
|