Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Boolean counter?

by Utilitarian (Vicar)
on Dec 07, 2009 at 08:06 UTC ( #811443=note: print w/ replies, xml ) Need Help??


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.

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


Comment on Re: Boolean counter?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://811443]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2014-12-22 08:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (113 votes), past polls