> -----Original Message-----
> From: Bill Akins [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 02, 2003 3:48 PM
> To: [EMAIL PROTECTED]
> Subject: While loop, confused...
> 
> 
> Hi all!
>  
> I have this while loop in my script:
>  
> while (($type ne "Windows") || ($type ne "Linux")) {

Right here, you must have the full string "Windows" or "Linux"

> print "Enter TYPE of server to build. Linux or Windoze 
> [linux, windows]:
> \n";
> $type = <STDIN>;
> chomp $type;
> $type =~ tr/a-z/A-Z/;

Here you uppercase the response, so you will have "L" or "LINUX" but never
"Linux"

> if (($type eq "LINUX") || ($type eq "L")) {
> $type = "Linux"; }
> if (($type eq "WINDOWS") || ($type eq "W")) {
> $type = "Windows"; }
> }
>  
> I had hoped that it would prompt the user until they made a valid
> choice, either L, linux, w or windows.  Instead it loops over and over
> even if valid input is received.  What am I doing wrong here?
>  
> I have another while loop that works just fine:
>  
> while ($LUN !~ /\d+.\d+.\d+.\d+/) {
> print "Enter LUN to build boot partition on. LUN Format is 3.0.0.33
> [X.X.X.X]: \n";
> $LUN = <STDIN>;
> chomp $LUN; }
>  
> Thanx!
> 

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

Reply via email to