Perl last Statement
The Perl last statement is used to exit a loop statement block, thereby ending the loop; statements after the last statement are no longer executed, and the continue block is no longer executed.
Syntax
The syntax format is as follows:
last [LABEL];
Flowchart

Example
#!/usr/bin/perl
$a
=
10
;
while
(
$a
<
20
)
{
if
(
$a
==
15
)
{
$a
=
$a
1;
last
;
}
"
The value of a is:
$a
\n
"
;
$a
=
$a
1
;
}
Running the above program, the output is:
a 的值为: 10
a 的值为: 11
a 的值为: 12
a 的值为: 13
a 的值为: 14
Perl Loops