Perl continue blocks are usually executed before the conditional statement is evaluated again.
The continue statement can be used in while and foreach loops.
The syntax format of the continue statement in the while loop is as follows:
while(condition){ statement(s);}continue{ statement(s);}The syntax format of the continue statement in the foreach loop is as follows:
foreach $a (@listA){ statement(s);}continue{ statement(s);}Use continue statement in while loop:
Executing the above program, the output result is:
a = 0a = 1a = 2
Use the continue statement in the foreach loop:
Executing the above program, the output result is:
a = 1a = 2a = 3a = 4