continue
- continue
When followed by a BLOCK, continueis actually a flow control statement rather than a function. If there is acontinueBLOCK attached to a BLOCK (typically in awhileorforeach), it is always executed just before the conditional is about to be evaluated again, just like the third part of aforloop in C. Thus it can be used to increment a loop variable, even when the loop has been continued via thenextstatement (which is similar to the Ccontinuestatement).last,next, orredomay appear within acontinueblock;lastandredobehave as if they had been executed within the main block. So willnext, but since it will execute acontinueblock, it may be more entertaining.Omitting the continuesection is equivalent to using an empty one, logically enough, sonextgoes directly back to check the condition at the top of the loop.When there is no BLOCK, continueis a function that falls through the currentwhenordefaultblock instead of iterating a dynamically enclosingforeachor exiting a lexically enclosinggiven. In Perl 5.14 and earlier, this form ofcontinuewas only available when the"switch"feature was enabled. See feature and Switch Statements in perlsyn for more information.