Thanks guys,
Before creating this thread, I had made the mistake of testing it like this:
perl -e '$cmd = "$var1 = 5;";eval $cmd;print $var1'but of course that failed because of the double quotes. So now I've changed it to this:
perl -e '$cmd = q[$var1 = 5;];eval $cmd;print $var1'which works just like a bought one.
Thanks for your help.
tel2
In reply to Re: Executing a string as a Perl command
by tel2
in thread Executing a string as a Perl command
by tel2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |