Labels: Create an infinite loop to demonstrate how last will break out of multiple code blocks.
#!/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";