in reply to Re: A TRUE-once variable
in thread A TRUE-once variable
The if with the .. operator there returns true exactly once (so long as $a isn't externally modified) for the entire life of the program.$a=0; $_=0; while($_++<10) { if (! $a..(!$a)) { print "True!\n"; } else { print "False!\n"; } $a++; }
You can make the example a bit more concise using this:
But using an auto-increment in an expression where the target variable appears twice makes me nauseous. Probably indigestion from my C days.$a=0; $_=0; while($_++<10) { if (! $a..(!$a++)) { print "True!\n"; } else { print "False!\n"; } }
|
|---|