note
JavaFan
I'd write that as:
<code>
my $foo;
eval {$foo = bar->something(); 1} or die "eval failed ($@)";
$foo;
</code>
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.
736203
736203