in reply to Iteration condition...

You might have use for the "flip-flop" operator .., documented in perlop under Range Operators:
for( @input ) { if( /$start/ .. /$finish/ ) { do_this(); } else { do_that(); } }

Replies are listed 'Best First'.
Re^2: Iteration condition...
by kyle (Abbot) on Mar 31, 2008 at 15:10 UTC

    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.

      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/.