Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Iteration condition...

by kyle (Abbot)
on Mar 31, 2008 at 15:10 UTC ( [id://677558]=note: print w/replies, xml ) Need Help??


in reply to Re: Iteration condition...
in thread Iteration condition...

The trouble with using the flip flop directly is that it's still true when /$Finish/ matches, but the OP wants $State to be false when /$Finish/ matches. To account for this, my solution says ( ( /$Start/ .. /$Finish/ ) && ! /$Finish/ ). The inner parentheses are necessary because && binds tighter than the flip flop. Without them, it means ( /$Start/ .. ( /$Finish/ && ! /$Finish/ ) ), which is true at /$Start/ and then never turns false.

Replies are listed 'Best First'.
Re^3: Iteration condition...
by rhesa (Vicar) on Mar 31, 2008 at 15:22 UTC
    You're quite right. Gotta love boundary conditions ;-)

    As an alternative to the parentheses, you could replace && with and, which has low enough precedence: /$start/ .. /$finish/ and !/$finish/.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-04-19 10:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found