[LON-CAPA-users] perl if statement with two conditions

H. K. Ng lon-capa-users@mail.lon-capa.org
Thu, 15 Jun 2006 08:04:25 -0400


Have you tried $sym eq "<"? The double == is for numbers comparison.


At 10:39 PM 6/14/2006, you wrote:
>I am writing a problem containing an if statement with two conditions.
>if ($z < $answer and $sym == "<") {$two = "true"}
>elsif ($z > $answer and $sym == ">") {$two = "true"}
>else {$two = "false"}
>If $z is less than the answer and it is a less than statement it 
>should be true.
>  Also, if $z is greater than the answer and it is a greater than 
> statement, it
>is true.  Otherwise it is false.
>This is not working, I have tried other variations without luck.  Does anyone
>have a sugguestion.
>Thank You
>Paul Ciske
>LON-CAPA-users mailing list