in reply to How do you evaluate a perl command that is in a perl string?
noteval $string;
The string form of C<eval> will cause the string to be compiled and executed at run-time, capturing the result in $@.eval { $string };
The block form of C<eval> gets compiled only once during the compilation pass of the main program and at run-time the result of executing $string are captured into $@.
Both versions of C<eval> isolate the main program from failures of the code in $string, but only the string-form causes the code to be compiled each time the C<eval> is encountered.
--
zf
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How do you evaluate a perl command that is in a perl string?
by Errto (Vicar) on Jan 20, 2006 at 23:34 UTC |