in reply to Flip Flop IV
Since TRUE and FALSE are barewords in your code, I assume that they are subroutine calls.
Otherwise, they would be caught with use strict (which everyone uses, right?). That is (remembering that use constant defines subroutines),
use constant FALSE => 0; use constant TRUE => !FALSE;
Assuming that they return 1 and 0 (or 0 and 1, it doesn't matter), then this would work:
Just use the xor operator:
my $debug = FALSE; # or 0 $debug ^= 1; # now it's TRUE, or 1 $debug ^= 1; # now it's FALSE, or 0
or use this:
$debug = !$debug; # change 1 to 0 or 0 to 1
update: added !, explanation/assumption at top.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Flip Flop IV
by grinder (Bishop) on Jun 25, 2001 at 16:58 UTC |