My code is actually evaluating ('y' or 'yes') first, then comparing the (boolean) result (true since 'y' is not an empty string) to the value of $answer.
If I correctly understand this statement, I would make the following small, but important, clarification:
<quibble>
The expression
('y' or 'yes')
will always return 'y' specifically (rather than a 'canonical' true of 1) because the short-circuiting logical-or operator returns the value of the first operand that is true (or false if none is true). Thus
(($answer eq 'y') or ($answer eq 'yes'))
(fully parenthesized) is probably certainly better than
($answer eq ('y' or 'yes'))
because the former will actually get around to evaluating ($answer eq 'yes') someday if $answer is not 'y'.
</quibble>
This may seem a mere, quibbling detail, but the Devil (and the 3 AM, tearing-your-hair-out debug session) is in the details.
In reply to Re^3: unexpected STDIN
by AnomalousMonk
in thread unexpected STDIN
by GhodMode
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |