On Fri, Mar 21, 2008 at 05:27:04PM +0100, Abigail wrote: > Inspecting $@ to check whether an eval die()d is wrong. It can > trigger both false positives, and false negatives: > > [snip] > > The correct way of checking whether an eval failed is to check its return > value: > > [snip] The documentation for eval should probably be updated... perldoc -f eval [...] If there is a syntax error or runtime error, or a die statement is executed, an undefined value is returned by eval, and $@ is set to the error message. If there was no error, $@ is guaranteed to be a null string. [...] [...] # make divide-by-zero nonfatal eval { $answer = $a / $b; }; warn $@ if $@; [etc.] RonaldThread Previous | Thread Next