Try this:

for ($i=0; $i<@inlocation; $i++) {
        print ("Error location is required\n") if ( $inlocation[$i] !~
/\w+/);
}


----- Original Message -----
From: "Scot Robnett" <[EMAIL PROTECTED]>
To: "Teresa Raymond" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, May 01, 2002 8:03 PM
Subject: RE: $_ and while stmt


> You could use 'for' instead of 'while' in this case, I think. Example:
>
> my @inlocation = (one,two,three,four,five,six,seven);
> for (@inlocation) {
>  if(($_ eq "two") or ($_ eq "four") or ($_ eq "six")) {
>   print "$_ is an even number. \n";
>  }
>  else {
>   print "$_ is an odd number. \n";
>  }
> }
>
>
> Scot Robnett
> inSite Internet Solutions
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
>
>
>
> -----Original Message-----
> From: Teresa Raymond [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 01, 2002 6:35 PM
> To: [EMAIL PROTECTED]
> Subject: $_ and while stmt
>
>
> I'm trying to test @inlocation to make sure it is not null or filled
> in with a space but although I input via ckbox a value, the error msg
> is returned.  I am not comfortable using the while or the $_.
>
> while (length @inlocation)
> {if ($_ eq "" || $_ eq " ")
> {
> print "Error location is required\n";
> }
> }
> --
> -------------------------------
> -  Teresa Raymond             -
> -  Mariposa Net               -
> -  http://www.mariposanet.com -
> -------------------------------
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


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

Reply via email to