>#!perl -wl >$x = "one plus one"; #watch out for this one! >print "yes" if $x = "two"; #Why does this work? The assignment succeeded, >print $x; #so it's true. >This works because of the /"$x = "two"/ part. >This is always true, because it assigns the value succesfully. No. The result of an assignment is the thing being assigned to (*not* the value of the thing being assigned to), so the result of $x = "two" is $x. This is then evaluated for the if, resulting in "two", which is a true value, so "yes" is printed. This can be seen in John's example: |#!perl -wl | |$x = "one plus one"; |print "yes" if $x = ""; |print "\$x is $x\n"; where the assignment is still successful, but "yes" isn't printed, because when $x is evaluated for the if, it results in the empty string, which is a false value. |# Found = in conditional, should be ==. |File 'Untitled'; Line 4 |$x is | |What I was expecting was no "Yes", but also no warning. Why not? There's still an assignment in the conditional. Brian ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch