Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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 imbibing at the Monastery: (4)
As of 2015-07-04 00:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls