Hello fwp'ers, Here's a golfish problem that I thought some people might enjoy:
What is the shortest way to test a variable for truth and then set its value to false such that the truth test still succeeds? For example, I have a global variable $a (given) that is somehow set to true. I want to test it for truth and do something: <snip> $a = 1; ... if( $a ) { $a = 0; do_something(); } ## and now $a is false ... </snip> You can't do this: if( $a = $a ? 0 : $a ) { do_something(); ... } because the whole expression becomes false when $a is assigned 0. My shortest try is this (10 characters w/o whitespace): if( $a%2 .. $a-- ) { do_something(); ... } Assuming warnings and stricture, can anyone find a shorter test/assignment? It doesn't have to be numeric (i.e., bit strings or any true/false values will work). Good luck! Scott -- Scott Wiersdorf [EMAIL PROTECTED]