以下是检查标量变量是否在Perl中初始化的最佳方法,使用defined?
defined
my $var; if (cond) { $var = "string1"; } # Is this the correct way? if (defined $var) { ... }
perl
perl ×1