programming-examples/perl/Statement/Labels Create an infinite loop to demonstrate how last will break out of multiple code blocks.pl
2019-11-15 12:59:38 +01:00

18 lines
299 B
Perl

#!/usr/local/bin/perl -w
# Define the label name.
EXIT:
{
for (;;)
{
my $x = 0;
for (;;$x++)
{
print "$x, \n";
last EXIT if $x >= 5;
}
}
}
print "Out of for loops.\n";