AW: Exiting loop to higher level

2002-09-30 Thread Hughes, James

Thanks, 

but I need something that will take me past the first "if" statement...
Something that itterates past the if, and tells the while to go on with the
next lump of data...
"next" will only break the inner "if" loop.

best regards,

James Hughes



-Ursprungliche Nachricht-
Von: James Edward Gray II [mailto:[EMAIL PROTECTED]]
Gesendet: Montag, 30. September 2002 16:34
An: Hughes, James
Cc: [EMAIL PROTECTED]; Jones, Jeremy
Betreff: Re: Exiting loop to higher level


Drop the double.  'next' is what you're looking for.

James Gray

On Monday, September 30, 2002, at 09:28  AM, Hughes, James wrote:

> Hi folks,
>
>
> Quick question I left my books at home. I am sure I'e seen a way 
> to next
> a loop to a higher level.
>
>
> Let me explain..
>
>
> while <> {
>
>   if ($_ =~ /something I need to find/) {
>
>   if ($_=~/something that tells me I need to look 
elsewhere/)
> {
>   doublenext; # exits to next itteration of while
> loop :-) Bypassing higher IF.
>   }
>   else {
>   do something cool;
>   }
>   }
>   else  {
>   do something less cool;
>   }
>
> }
>
> I know there is not a function "doublenext", but what can I do to get 
> the
> functionality of the fabled "doublenext"?
>
> Thanks.
>
> At work having writers block
>
>
>
> James Hughes
>
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

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




Re: AW: Exiting loop to higher level

2002-09-30 Thread James Edward Gray II

Sorry, but this isn't accurate.  Try it and I think you'll be 
surprised.  The next() subroutine takes you to the next iteration of 
the enclosing LOOP.  Control statements, like if, are not loops and 
thus have nothing to do with where next() sends you.

When you do have two loops and want to break to the outer one, you can 
use a label.

LABEL:  while (SOMETHING) {
while (SOMETHING_ELSE) {
next LABEL if SOME_REASON;  # breaks to the first loop
}
}

But, this is not needed in your example, if I'm understanding your 
question correctly.  Good luck.

James Gray

On Monday, September 30, 2002, at 09:45  AM, Hughes, James wrote:

> Thanks,
>
> but I need something that will take me past the first "if" 
> statement...
> Something that itterates past the if, and tells the while to go on 
> with the
> next lump of data...
> "next" will only break the inner "if" loop.
>
> best regards,
>
> James Hughes
>
>
>
> -Ursprungliche Nachricht-
> Von: James Edward Gray II [mailto:[EMAIL PROTECTED]]
> Gesendet: Montag, 30. September 2002 16:34
> An: Hughes, James
> Cc: [EMAIL PROTECTED]; Jones, Jeremy
> Betreff: Re: Exiting loop to higher level
>
>
> Drop the double.  'next' is what you're looking for.
>
> James Gray
>
> On Monday, September 30, 2002, at 09:28  AM, Hughes, James wrote:
>
>> Hi folks,
>>
>>
>> Quick question I left my books at home. I am sure I'e seen a way
>> to next
>> a loop to a higher level.
>>
>>
>> Let me explain..
>>
>>
>> while <> {
>>
>>  if ($_ =~ /something I need to find/) {
>>
>>  if ($_=~/something that tells me I need to look
> elsewhere/)
>> {
>>  doublenext; # exits to next itteration of while
>> loop :-) Bypassing higher IF.
>>  }
>>  else {
>>  do something cool;
>>  }
>>  }
>>  else  {
>>  do something less cool;
>>  }
>>
>> }
>>
>> I know there is not a function "doublenext", but what can I do to get
>> the
>> functionality of the fabled "doublenext"?
>>
>> Thanks.
>>
>> At work having writers block
>>
>>
>>
>> James Hughes
>>
>>
>> -- 
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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