in reply to Boolean counter?
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")
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Boolean counter?
by doug (Pilgrim) on Dec 07, 2009 at 18:22 UTC | |
by ikegami (Patriarch) on Dec 07, 2009 at 18:37 UTC |