Its "last" what you are looking for. This will break out of the inner-most loop. Optionally, you can put a label at the start of your loop and exit it by name, like:
my $foo = 0; OUTER: while (1) { INNER: while (1) { $foo++; if ($foo > 1) last INNER; } } The "last INNER" will exit the inner loop. If it were "last OUTER" it would exit both of them immediately. This is the same thing as executing a GOTO statement to a label outside the loops, but it seems cleaner in the code. -dZ. ----- Original Message ----- From: [EMAIL PROTECTED] Sent: 4/18/2006 9:58:15 AM To: [EMAIL PROTECTED] Cc: perl-win32-users@listserv.ActiveState.com;[EMAIL PROTECTED] Subject: Re: breaking out of a for/foreach loop... > > Bruce, > > You can use a "Label" and a "goto" statement. > > > for (@array) > { > if (condition met) > { > goto Label; > } > } > > LABEL: > ... > > Hope this helps. > > Dave Kazatsky > Senior Middleware Engineer > NSE - Solutions Engineering > W. (732) 893-4351 > C. (973) 865-8106 > > > |---------+-------------------------------------------------> > | | "bruce" <[EMAIL PROTECTED]> | > | | Sent by: | > | | [EMAIL PROTECTED]| > | | veState.com | > | | | > | | | > | | 04/17/2006 10:00 PM | > | | Please respond to bedouglas | > | | | > |---------+-------------------------------------------------> > > >--------------------------------------------------------------------------------------------------------------------------------| > | > | > | To: perl-win32-users@listserv.ActiveState.com > | > | cc: > | > | Subject: breaking out of a for/foreach loop... > | > > >--------------------------------------------------------------------------------------------------------------------------------| > > > > > > ok.. > > i'm embarassed.. how does one break out of a for/foreach loop?? > > i thought it was exit/break... > > pointers? > > thanks > > -bruce > > _______________________________________________ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > > > > The information contained in this message may be CONFIDENTIAL and is for the > intended addressee only. Any unauthorized use, dissemination of the > information, or copying of this message is prohibited. If you are not the > intended addressee, please notify the sender immediately and delete this > message. > _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs