eval($code) or warn "broken code - $@";
That's a big oops.
The problem is that eval() returns whatever the eval'd code does. That would fail if the last expression in the code resulted in any false value, even if the code was perfectly fine. The Right Way™ is to check whether $@ is true.
my $result = eval($code); warn "eval borked: $@" if $@;
-sauoq "My two cents aren't worth a dime.";
In reply to Re: Re: To use do or eval
by sauoq
in thread To use do or eval
by Angel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |