If you are comparing numbers, you want to use == (strings use eq).
You probably also only want to have one set of parens:
if ($a == $b || $a == $c || $a == $d) {print "here"}
or you could clarify further:
if (($a == $b) || ($a == $c) || ($a == $d)) {print "here"}
You should put the following lines at the top of your perl scripts, they
would likely have helped you solve some of this on your own:
use strict;
use warnings;
-----Original Message-----
From: Lance Prais [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 26, 2002 4:56 PM
To: Perl
Subject: "Or" Syntax
If I wanted to say:
If a=b or a=c or a=d do this How would I do that?
I thought I could do it like this but it did not work.
1.
If ($a=b) || ($a=c) || ($a=d)
{
DO this
}
2.
If ($a=b) || if ($a=c) || if ($a=d)
{
DO this
}
Could someone tell help me with this?
Thanks in advance
Lance
--
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]