in reply to Executing a string as a Perl command
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Executing a string as a Perl command
by johnpeterdinesh (Initiate) on May 10, 2011 at 09:22 UTC | |
by JavaFan (Canon) on May 10, 2011 at 11:14 UTC | |
by ww (Archbishop) on May 10, 2011 at 12:29 UTC | |
by ctilmes (Vicar) on May 16, 2011 at 10:48 UTC | |
by Anonymous Monk on May 16, 2011 at 11:01 UTC | |
by ctilmes (Vicar) on May 16, 2011 at 13:25 UTC |