Hi Susan
"Susan Aurand" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> Is there an AND operator in perl? For example;
>
> if ($SRF=1 and $SRL=1) {print"YES";)
>
> Any help would be appreciated.
> Thank you - Susan
>
What you've written will work as it is, except that for comparing numeric
quantities for equality you need '==' instead of the assigment operator '='.
(You also have a typo - a closing parenthesis instead of a closing brace).
Try this:
if ($SRF == 1 and $SRL == 1) { print "YES" };
Perl provides both the C-like '&&' operator and 'and', which do the same
thing but bind with their operands with different priorities. The most
important difference is that the assignment operators have a lower priority
than '&&' but a higher priority than 'and', so:
$bool = $SRF == 1 && $SRL == 1
means
$bool = (($SRF == 1) && ($SRL == 1))
but
$bool = $SRF == 1 and $SRL == 1
means
($bool = ($SRF == 1)) and ($SRL == 1)
HTH,
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]