First, I don't 'my' $foo inside the block. Second, an eval may fail, yet leave $@ false (because of 'end of scope' effects). So you should make sure that on success, the eval returns a defined value, and check the return value of the eval.my $foo; eval {$foo = bar->something(); 1} or die "eval failed ($@)"; $foo;
In reply to Re: eval and return values
by JavaFan
in thread eval and return values
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |