One more way...

$toggle = 1 - $toggle;
This lacks elegance since it needs to start at 0 or 1, but it is simple.

In reply to Re: Boolean counter? by eye
in thread Boolean counter? by DreamT

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":