Do you know where your variables are? | |
PerlMonks |
Re: Bug in eval in pre-5.28by haukex (Archbishop) |
on Apr 07, 2021 at 11:51 UTC ( [id://11130946]=note: print w/replies, xml ) | Need Help?? |
On pre-5.14 Perls, this is a bug. I just wanted to mention that some of the known remaining bugs (1, 2, 3) weren't fixed until v5.28. Basically, at this point, I would never recommend eval { ... }; if ($@) { ... }. my $success = eval { ...; 1 }; is The Right Way To Do It.* And remember that $@ could still be a false value. * TIMTOWTDI still applies: eval { ...; 1 } or do { ... };, unless ( eval { ...; 1 } ) { ... }, my $ok = eval { ...; 1 }; if (!$ok) { ... }, and so on.
In Section
Meditations
|
|