Perl $#ARGV

[oracle@dwh1 ~]$ cat 4.pl
if ($#ARGV <0){
        print "请输入一个表名参数";
print "\$#ARGV is $#ARGV\n";
        exit(-1);
    }else{
print "\$#ARGV is $#ARGV\n";
}

[oracle@dwh1 ~]$ perl 4.pl
请输入一个表名参数$#ARGV is -1


$#ARGV  参数个数减去1 ,0个参数减去1 就是-1


[oracle@dwh1 ~]$ perl 4.pl 1
$#ARGV is 0

你可能感兴趣的:(Perl高级编程)