What you want is not a counter but a toggle, shortened using the ternary operator, but not sure if it's more elegant
Edit...In fact Corion's solution above is way better.

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."

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

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