in reply to Re: Can you check the syntax of a eval() before executing it?
in thread Can you check the syntax of a eval() before executing it?
That way one wouldn't have to recompile the code, if you really need that kind of optimization. It is also quite possible that there is code that can't be evaled into a sub like this. But maybe it'll suffice. :)my $coderef = eval "sub{$code}" or die "Error in code: $@"; $coderef->(); # execute the code
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Can you check the syntax of a eval() before executing it?
by ariels (Curate) on May 07, 2002 at 07:48 UTC | |
by Dog and Pony (Priest) on May 07, 2002 at 09:09 UTC |