Actually, the way that it is is correct, albeit it should be
if ( (lc($autosubmit) ne "y") and (lc($autosubmit) ne "n") )
Truth tables:
p q ~p ~q p^q ~p v ~q ~( p ^ q )
T T F F T F F
T F F T T F F
F T T F T F F
F F T T F T T
where
p = lc($autosubmit) eq "y" and
q = lc($autosubmit) eq "n"
if $autosubmit is "Y", then p is True and q is false (lc("Y") = "y" but lc("Y") does not equal "n"), thus the statement as a whole is false and we do not enter the loop. The only time the loop is activated is if both conditions fail ( that is $autosubmit is neither "y" nor "n" ). Conversely (or contrapositively, whatever the term is - I forget), the same could be written as:
unless ( lc($autosubmit) eq "y" or lc($autosubmit) eq "n" )
shown above as
~(p ^ q)
Update: wow, I need to re-read - you come to the same conclusions, but it's just that the OP
wants to bypass the "if" in that case (either y or n). So I posted truth tables in vain =) The issue here is that it will only be called once - on the first failure.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.