in reply to Re^2: at continue, last
in thread at continue, last

> $loop is used in the conditional, so if I decremented it first,...

Unclear.

None of your examples have $loop in the conditional and I suggested decrementing it after not before !

Please explain what's different here

if ( $condition1 ) { ... unless( $condition2 ) { ... } --$loop; # common exit point }

Cheers Rolf

(addicted to the Perl Programming Language)

Replies are listed 'Best First'.
Re^4: at continue, last
by djerius (Beadle) on Jun 06, 2014 at 18:28 UTC
    Sorry, my reply was clearer in my head then in my written words

    I meant to write that if I decremented it as the first statement in the if clause, I'd have to increment later on.

    The point of the examples wasn't the decrement, but to examine the ways of finding a single path to cleanup code from a conditional. In particular, I'm trying to avoid the nested if/else/unless clauses.

      > In particular, I'm trying to avoid the nested if/else/unless clauses.

      As I already explained you have always the same exit point. where the decrement can safely happen.

      May it be last or goto LABEL , you have plenty of possibilities to reach it, w/o nesting if clauses.

      Cheers Rolf

      (addicted to the Perl Programming Language)

        I believe we're in agreement. Thanks.