in reply to Test break, but still doing

Forgive me if I've completely misunderstood your question, but why not just shove the next into the if-block?:

if ($sth->rows >= 1) { my $sth = $dbh->prepare("UPDATE artists SET email=? WHERE alias=?" +); $sth->execute($email[$artistkey], $artist_alias[$artistkey]); next; }

Replies are listed 'Best First'.
Re: Re: Test break, but still doing
by Coplan (Pilgrim) on Feb 21, 2001 at 11:32 UTC
    If I stuck next; at the end of the if loop, that breaks the if loop, would it not? It's the for loop that I want to break. --Coplan

      Did you try it? next doesn't apply to if-blocks, it applies to the enclosing loop-block (for or while, or a naked block which is a loop executed once) ... if-blocks are not loops. Similarly for redo and last.

        And if you do have nested loops, you can always break out of the one that you want by using labels...
        LAB_1:
          while ([cond1]) {
        
        LAB_2:
            while ([cond2]) {
              next LAB_1 if [cond3];
            }
          }
        
        As archon says, its all there in the perlsyn page.