Perl last statement
Perl last
statement is used to exit the loop statement block, thus ending the loop last
the statement after the statement is no longer executed continue
statement blocks are no longer executed.
Grammar
The syntax format is as follows:
last [LABEL];
Flow chart
Example
#!/usr/bin/perl$a=10;while($a<20){if($a==15){#
exit a loop $a=$a+1;last;}print"The value of a is:$a\\n";$a=$a+1;}
Execute the above program, and the output is as follows:
The value of a is: 10
The value of a is: 11
The value of a is: 12
The value of a is: 13
The value of a is: 14