Take a look at a source of a neat module Try::Tiny, which has "safe eval"-ing as the only goal. Can be used as a replacement of own eval-s. Does more or less what other respondents wrote, plus localizing $@.
In reply to Re: $@ can't be relied on?
by przemo
in thread $@ can't be relied on?
by sherab
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |