Adding another or works.

$String = 0;
$foo = 0;
$bar = 0;

print "Hello" if ($String) or ($foo) or ($bar);

Set any of the vars to 1 and it prints Hello. What's not working about
that...

John

-----Original Message-----
From: Tim Musson [mailto:[EMAIL PROTECTED]]
Sent: 03 July 2001 12:49
To: [EMAIL PROTECTED]
Subject: Best way to match 3 things?


PerlGuru's,

I had an    if {} elsif {}    and converted it to the following which
I like, but now find I need to match 3 things - not 2.

DoTheSub($PassedVar) if ($String eq "string") or ($foo =~ /$String/);

I tried adding another "or" to the above, but that did not work (I
didn't really think it would, but had to try <g>).
          or (AnotherSub($Var) eq "\tText")

What would be the best way to run my sub (DoTheSub in the above
example) if any of 3 things matched?  Should I go back to:
         if(){ }elsif(){ }else(){ }
or is another way better?

TIA

-- 
[EMAIL PROTECTED]
Using The Bat! eMail v1.53d
Windows NT 5.0.2195 (Service Pack 1)
Ever stop to think, and forget to start again?


--------------------------Confidentiality--------------------------.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.


Reply via email to