* Jayakumar Rajagopal <[EMAIL PROTECTED]> [2004-04-15T14:22:08] > $a=100; $b=200; > ($a=3 && $b=6 ) if ( 1 == 1 ); > print " $a $b \n"; > > Output : 6 6 > > OR my syntax is wrong ? > regards, > Jay
Your understanding of precedence is wrong. You've effectively said this: ($a = (3 && $b = 6)) if 1; The value of (3 && $b = 6) is the value of the last evaluated bit, $b=6. You have two options: 1. say "($a=3 and $b=3)" instead, because the precedence level of 'and' is different 2. use parentheses so that you don't have to memorize precedence I suggest 2, although learning precedence is good. -- rjbs
pgp00000.pgp
Description: PGP signature