use strict; my $var = NULL;
会引发
Bareword "NULL" not allowed while "strict subs" in use
Perl 中没有 NULL。但是,变量可以是
undef
my $var; # variables are undefined by default undef $var; # undef() undefines the value of a variable $var = undef; # same, using an alternative syntax
要检查变量的定义性,请使用
defined()
print "\$var is undefined\n" unless defined $var;
裸词
NULL
q/NULL/