我见过好几个posts那个状态use 5.12.0;
在 Perl 中默认启用某些功能/编译指示(例如, use strict;
)。另一个例子是在 UTF-8 and perl据说 use 5.14.0;
是
optimal for Unicode string feature UTF-8 handling.
我似乎记得一个可用的
use
提供某些默认值的声明(例如, use strict; use warnings; use diagnostics;
),但不记得具体细节。如何找出给定 use 5.##.#;
中包含的内容陈述?例如,什么是use 5.22.0;
默认提供? use strict;
?
最佳答案
这记录在 perldoc feature
中:
It's possible to load multiple features together, using a feature bundle. The name of a feature bundle is prefixed with a colon, to distinguish it from an actual feature.
use feature ":5.10";
The following feature bundles are available:
bundle features included --------- ----------------- :default array_base :5.10 say state switch array_base :5.12 say state switch unicode_strings array_base :5.14 say state switch unicode_strings array_base :5.16 say state switch unicode_strings unicode_eval evalbytes current_sub fc :5.18 say state switch unicode_strings unicode_eval evalbytes current_sub fc :5.20 say state switch unicode_strings unicode_eval evalbytes current_sub fc :5.22 say state switch unicode_strings unicode_eval evalbytes current_sub fc
在哪里
use v5.10.0;
will do an implicit
no feature ':all'; use feature ':5.10';
and so on.
自动启用限制记录在
perldoc -f use
中:if the specified Perl version is greater than or equal to 5.12.0, strictures are enabled lexically as with
use strict
.
关于Perl:使用 5.##.# 中包含什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31257555/