Instead of
eval { $display };
use
eval $display;
The former executes the code $display (not the code stored in $display), which simply returns the value of $display. The latter compiles and executes the Perl code stored in $display. Both trap exceptions.
Reference: eval
Update: Roy Johnson brought it to my attention that you have insufficient slashes in your Debug argument.
&Debug("system(\"copy c:\\oldversion.txt c:\\version.txt \");", 1);
results in the string
system("copy c:\oldversion.txt c:\version.txt ");
but that's not what you want. You want
system("copy c:\\oldversion.txt c:\\version.txt");
so you should be using
&Debug("system(\"copy c:\\\\oldversion.txt c:\\\\version.txt\");", 1);
In reply to Re: How do you evaluate a perl command that is in a perl string?
by ikegami
in thread How do you evaluate a perl command that is in a perl string?
by perlNinny
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |