cam.pm challenge

2002-05-28 Thread Matthew Byng-Maddick
I'm surprised that noone has cross-posted this here yet, but I posted http://cam.pm.org/archive/2002-May/000761.html to cam.pm on Friday Night. The competition is open to anyone, but since I have only had two solutions to boggle over so far, I thought I'd post it here, and see what comes in. If yo

Re: shortest test for truth & false assignment

2002-05-28 Thread Ilmari Karonen
On Wed, 22 May 2002, Scott Wiersdorf wrote: > > 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? > > if( $a ) { > $a = 0; > do_something(); > } I think you've got it. Since you specified the if-