in reply to Boolean counter?
What you want is not a counter but a toggle, shortened using the ternary operator, but not sure if it's more elegant
$toggle=$toggle?0:1;
Edit...In fact Corion's solution above is way better.
$toggle=$toggle?0:1;
Edit...In fact Corion's solution above is way better.
print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."
|
---|
In Section
Seekers of Perl Wisdom