[root@dr-mysql01 ~]# cat x.pl
@arr=($tmp1[-1], $tmp2[-1],2);
if (@arr){print "111111
"};
print "$arr[0] is $arr[0]
";
print "$arr[1] is $arr[1]
";
[root@dr-mysql01 ~]# perl x.pl
111111
$arr[0] is
$arr[1] is
数组元素为空,和没有数组元素是两码事
[root@dr-mysql01 ~]# cat y.pl
@arr;
if (@arr){print "111111
"};
print "$arr[0] is $arr[0]
";
print "$arr[1] is $arr[1]
";
[root@dr-mysql01 ~]# perl y.pl
$arr[0] is
$arr[1] is