Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have a case in my code , where I am asking user to input either Y or N and if they enter something else I want them to re enter , so I have written a while loop such that
print "Do you wish to update (Y/N)?\n"; my $choice = <>; chomp $choice; while ($choice ne "Y" || $choice ne "y" || $choice ne "N" || $choice +ne "n")
but eve if I press Yor N , the flow enters this while loop . so I cant can't understand why ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: comparison of character
by roboticus (Chancellor) on Jul 16, 2013 at 11:14 UTC | |
|
Re: comparison of character
by choroba (Cardinal) on Jul 16, 2013 at 11:16 UTC | |
|
Re: comparison of character
by moritz (Cardinal) on Jul 16, 2013 at 11:15 UTC | |
|
Re: comparison of character
by rjt (Curate) on Jul 16, 2013 at 11:39 UTC | |
|
Re: comparison of character
by davido (Cardinal) on Jul 16, 2013 at 15:57 UTC | |
|
Re: comparison of character
by hippo (Archbishop) on Jul 16, 2013 at 11:14 UTC | |
|
Re: comparison of character
by BillKSmith (Monsignor) on Jul 16, 2013 at 15:05 UTC | |
|
Re: comparison of character
by Anonymous Monk on Jul 16, 2013 at 11:21 UTC | |
by MidLifeXis (Monsignor) on Jul 16, 2013 at 13:03 UTC | |
by Anonymous Monk on Jul 16, 2013 at 13:37 UTC | |
by Laurent_R (Canon) on Jul 16, 2013 at 11:40 UTC | |
by Anonymous Monk on Jul 16, 2013 at 13:00 UTC | |
by Laurent_R (Canon) on Jul 16, 2013 at 17:44 UTC | |
by Anonymous Monk on Jul 16, 2013 at 11:22 UTC |