[oracle@oadb tmp]$ cat a1.pl 
$i=1;
while (1==1){
$i++;

print "1----------\$i is $i\n";
if ($i == 7){print "2-------\$i is $i\n";last;}
print "${i}xxxxxxxxxxxxxx${i}\n";
};


[oracle@oadb tmp]$ perl a1.pl
1----------$i is 2
2xxxxxxxxxxxxxx2
1----------$i is 3
3xxxxxxxxxxxxxx3
1----------$i is 4
4xxxxxxxxxxxxxx4
1----------$i is 5
5xxxxxxxxxxxxxx5
1----------$i is 6
6xxxxxxxxxxxxxx6
1----------$i is 7
2-------$i is 7

last 退出当前循环:

[oracle@oadb tmp]$ cat a2.pl
while (1==1){
$j=$j+5;
print "\$j===$j\n";
$i=1;
while (1==1){
$i++;

print "1----------\$i is $i\n";
if ($i == 7){print "2-------\$i is $i\n";last;}
print "${i}xxxxxxxxxxxxxx${i}\n";
};
sleep 5;
};

[oracle@oadb tmp]$ perl a2.pl
$j===5
1----------$i is 2
2xxxxxxxxxxxxxx2
1----------$i is 3
3xxxxxxxxxxxxxx3
1----------$i is 4
4xxxxxxxxxxxxxx4
1----------$i is 5
5xxxxxxxxxxxxxx5
1----------$i is 6
6xxxxxxxxxxxxxx6
1----------$i is 7
2-------$i is 7
$j===10
1----------$i is 2
2xxxxxxxxxxxxxx2
1----------$i is 3
3xxxxxxxxxxxxxx3
1----------$i is 4
4xxxxxxxxxxxxxx4
1----------$i is 5
5xxxxxxxxxxxxxx5
1----------$i is 6
6xxxxxxxxxxxxxx6
1----------$i is 7
2-------$i is 7