- 论坛徽章:
- 46
|
本帖最后由 zhlong8 于 2010-11-13 20:17 编辑
很简单,这样用根本就是错的,文档说的很清楚。ActivePerl 自带的 perlcritic 可以检查这种错误,而 strict 查检末声明变量是在编译期进行的。
perlsynNOTE: The behaviour of a my statement modified with a statement modifier conditional or loop construct (e.g. my $x if ... ) is undefined. The value of the my variable may be undef, any previously assigned value, or possibly anything else. Don't rely on it. Future versions of perl might do something different from the version of perl you try it out on. Here be dragons. |
|