in reply to Perl etiquette - eval

A few random thoughts about eval blocks.

  1. There are some errors that are difficult to catch without an eval-block. The most notable of these is division by zero and other floating point errors. I have recently used eval to cacth a division by zero. It would be much more difficult to test for a zero denominator because the divisions appear inside complicated formualae. Also very small denominators can cause overflow too which should be treated just the same (this is floating-point).
  2. In perl, you can in many cases use last or goto as a non-local jump too, so eval/die is not the only command for it. Pity Perl has too many limitations for this: you can't goto out from a sort function, you have to no warnings exiting; labels are not lexical...