- 求职 : 软件工程师
- 论坛徽章:
- 3
|
- Incompatible Changes
- The autoderef feature has been removed
- The experimental autoderef feature (which allowed calling push, pop, shift, unshift, splice, keys, values, and each on a scalar argument) has been deemed unsuccessful. It has now been removed; trying to use the feature (or to disable the experimental::autoderef warning it previously triggered) now yields an exception.
- Lexical $_ has been removed
- my $_ was introduced in Perl 5.10, and subsequently caused much confusion with no obvious solution. In Perl 5.18.0, it was made experimental on the theory that it would either be removed or redesigned in a less confusing (but backward-incompatible) way. Over the following years, no alternatives were proposed. The feature has now been removed and will fail to compile.
复制代码
感觉值得注意的就这两条。
第一条我感觉很遗憾,自动解引用十分方便,既然取消了,那么就要多写一些东西了:
- push $ref_array, $scalar;
- # push @{$ref_array}, $scalar;
复制代码
第二条就是默认变量 $_, 再不能 my 了,反正我尽量不用 Perl 的这个看似让代码更简洁的特性,我认为这让代码第一眼看上去很难懂,需要大脑解析器进行一次参数插入。 |
|