in reply to Help choosing the most efficient, dependable condition(al)
Without trying to dumpster-dive into this particular debate, I would note that it is easy to avoid messages like “use of uninitialized value” through the use of the && (logical-AND) operator, which uses so-called short circuit evaluation: if the left-hand side is False, the right-hand side is not evaluated at all. (See perldoc perlop.)
Thus, you can say (say...):
if ( $ENV{'HTTP_ACCEPT'} && ( $ENV{'HTTP_ACCEPT'} =~ ...
undef is always False. So, the statement quits right there and the remainder of the expression is never evaluated.
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help choosing the most efficient, dependable condition(al)
by boftx (Deacon) on Nov 13, 2013 at 21:44 UTC |