Perl 标签语句

表达式为假的情况:
逻辑值为假
值为0
字符串为空‘’
列表为空
undef


[oracle@jhoa perl2]$ cat 3.pl 
@array=qw/1 2 3 4 5 6 7 8 9/;
foreach $var (@array){
print "$var\n";
}
print "循环外\n";
print "$var\n";

[oracle@jhoa perl2]$ perl 3.pl 
1
2
3
4
5
6
7
8
9
循环外

[oracle@jhoa perl2]$ cat 4.pl 
print "使用标签:";
LABEL: for($i=1;$i<5;$i++){
           for ($j=1;$j<5;$j++){
               print "$j";
         last LABEL if $i==3;
        }
}
print "\$i is $i\n";
[oracle@jhoa perl2]$ perl 4.pl 
使用标签:123412341$i is 3

相关文章

1. 如何去重 #!/usr/bin/perl use strict; my %hash; while(...
最近写了一个perl脚本,实现的功能是将表格中其中两列的数据...
表的数据字典格式如下:如果手动写MySQL建表语句,确认麻烦,...
巡检类工作经常会出具日报,最近在原有日报的基础上又新增了...
在实际生产环境中,常常需要从后台日志中截取报文,报文的形...
最近写的一个perl程序,通过关键词匹配统计其出现的频率,让...