On Tue, Feb 9, 2010 at 8:05 PM, Dr.Ruud <[email protected]> wrote:
> Jay Savage wrote:
>
[snip]
> Because $@ is a global, it is best practice to act on
> the return value of eval itself:
[snip]
$@ is also *guaranteed*--in the words of perlfunc--to be set
correctly. I believe that historically this may not have been the
case: $@ may have only been set on failure and not flushed on success,
but in recent Perls it should be reliable.
> or do {
> my $eval_error = $@ || "unknown";
> print $eval_error, "\n";
This seems superfluous. If you don't trust $@ to be set correctly, why
interrogate it? I'm also curious under what circumstances you believe
the eval could fail but $@ not be true (i.e., when would you expect
your code to print "unknown"?).
-- j
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/