----- Original Message ----- 
From: Brett W. McCoy <[EMAIL PROTECTED]>
To: Jennifer Pan <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, July 26, 2001 9:12 PM
Subject: Re: if in a list
[...]
> 
> Here's how I would code this:
> 
> foreach (@mylist) {
> 
> $boolean = ($_ eq 'AF00001') ? 1 : 0;
> }
> 
> The conditional operator, ?:, tests an expression, and returns the first
> value if the test is true, and the second if the test is false.

You could alsio use:

if (grep{ $_ eq 'AF00001'}@mylist) {
    # do your stuff
}

maarten.


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

Reply via email to