mohadib_the_nasty has asked for the wisdom of the Perl Monks concerning the following question:

hello, I have a newbie question that i cant seem to find the answer for. sorry to bring such small issues before the Monks....but here it is.. how can i test multiple vars for truth in one loop I was thinking this if ($a && $b && $c) but i cant seem to get the syntax right. could someone show me the error of my ways thanks jd

Replies are listed 'Best First'.
Re: multiple test on a var
by Anonymous Monk on Jan 18, 2003 at 09:28 UTC
    What syntax error are you getting ? Here's a simple example to help you ;
    use strict; use warnings; # test 1 my ($a,$b,$c)=(1,1,1); if ($a && $b && $c){ print "All true\n"; } else { print "Not all true\n"; } # test 2 ($a,$b,$c)=(0,1,1); if ($a && $b && $c){ print "All true\n"; } else { print "Not all true\n"; }
    poj
Re: multiple test on a var
by mohadib_the_nasty (Initiate) on Jan 18, 2003 at 09:09 UTC
    Im really sorry about
    no br's.


    mohadib
      Better don't use any <br> tags. Wrap your paragraphs in <p> and </p> instead.

      -- Hofmator

A reply falls below the community's threshold of quality. You may see it by logging in.