defined 函数使用

#如果给定的值不是undef, defined()函数会返回 true 
#如果给定值是undef 则返回false.


my $test01 = "" ;

#it return ture it will print string.
if (defined $test01){
    print "var is defined
";
}

#it return false it will print string.
if (! defined $test02){
    print "var is undef
";
}
原文地址:https://www.cnblogs.com/jinxiang1224/p/8468170.html