Hi Anand,

Look at your logic:
until (($test ne 'Y') && ($test ne 'N') &&
             ($test ne 'y') && ($test ne 'n')) {...}  #until BAD input
This says that as long as there is good input, keep cyckling until you get bad input.  
You should either use while here, or change the condition to reflect the sought-after 
input:
until (($test eq 'Y') || ($test eq 'N') ||
             ($test eq 'y') || ($test eq 'n'))               #until GOOD input

Combined with the wrong test:
  if ($test eq 'N' || $test eq 'n')

What this says is:
Wait for the user to enter an bad response, then overwrite the file.
Since your contorl condition has insured that you will never get either Y, y, N, or n 
as input, whatever input you do receive will be sonething other than N or n, therefore 
your file will always be overwritten.  Remember, overwriting a file is destructive.  
Therefore test for y or Y.  If the user does not definitely say yes, you should not do 
it.

The until function is cute and all, but can be confusing.
while (you are not clear on the concept) {dont use it;}
until (you understand it better) {dont use it;}
One other point:  maybe your customers don't like being told what to do by a computer. 
 Most people despise it, in fact.  Let them type yes or no if they want, instead of 
just y or n:
if ($UserResponse =~ /^Y|^y/ ) {
  OverwriteOriginalFile();
} else {
  ExploreOtherOptions();
}
This would not proceed on "nay" for instance, but would go ahead on "yes", "yeah", 
"yep", "yuppers--you betchum!", and "yessireebob", as well as capitalized forms of any 
word starting with y..

Joseph


Anand Ramakrishna wrote:

>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to