The xor operator will do what you want:
$counter = $counter xor 1
or
$counter ^= 1
(tested with perl -wle "print $counter ^=1 for 1..3")
In reply to Re: Boolean counter?
by Corion
in thread Boolean counter?
by DreamT
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |