On Wed, 18 Jul 2001, Craig S Monroe wrote:

> I basically a have a series of nested while loops that prompts the user
> down a particular decision tree to a result.
> What I was wondering, is there a way to exit an inner loop directly to the
> initial while loop to start the program from the beginning?
> It looks as though labels are only effective in the loop that you are
> currently in?
> Is that correct?

No. If there is no label used with next last or redo, it applies to the
current enclosing loop, otherwise you can move back up the hierachy.  You
should be able to do:

LOOP1: while(<FILE) {

  #do stuff
  LOOP2: while(<ANOTHERFILE>) {

    #do stuff
    LOOP3: foreach $i (@array) {

      #do stuff
      next LOOP1 if $i < 3;
      next LOOP2;
    }
  }
}

-- Brett

                                   http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
Boy, am I glad it's only 1971...


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to