in reply to eval and return values
I'd write that as:
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 Section
Seekers of Perl Wisdom