以下代码将返回错误,
$ perl -E'sub foo { my $bar if 0; $bar++ }'
This use of my() in false conditional is no longer allowed at -e line 1.
但是这段代码
$ perl -E'sub foo { my $bar = undef if 0; $bar++ }'
不返回错误。这两种形式有什么区别吗?
以下代码将返回错误,
$ perl -E'sub foo { my $bar if 0; $bar++ }'
This use of my() in false conditional is no longer allowed at -e line 1.
但是这段代码
$ perl -E'sub foo { my $bar = undef if 0; $bar++ }'
不返回错误。这两种形式有什么区别吗?