Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Boolean counter?

by ikegami (Pope)
on Dec 07, 2009 at 17:08 UTC ( #811561=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Boolean counter?
in thread Boolean counter?

Don't modify a variable that you're using elsewhere in an expression. At best, it's unclear. At worse, the result is undefined.

$toggle = - --$toggle;
should be
$toggle = -( $toggle - 1 );
which can be shortened to previously mentioned
$toggle = 1 - $toggle;


Comment on Re^3: 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://811561]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (12)
As of 2015-07-30 07:18 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 (270 votes), past polls