NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
eval correct? (Score:1)
In your question you wrote:
I don't see that happening with just this line:
The "return" will return the value of "thatroutine()" outside the "eval", but it won't cause the inclosing subroutine to return, if I read the docs correctly. What am I missing?
Anyway, I usually prefer a simple, readable solution, one that doesn't depend on the short-circuit behaviour of "&&" and relatives (not everyone groks such code), even if it is a little more verbose. How about:
Reply to This
Re:eval correct? (Score:1)
Sorry, but that's a very poor reason to avoid the short circuit behaviour of boolean ops. Programmers worth their salt must know about it, it such a basic tool, so helpful tool for improving legibility, and so widespread among languages. Without flinching I will go so far as to suggest that those who really cannot figure it out even after explanations, possibly repeated, shouldn't be touching code in the first place.