Perl:使用中包含的内容5.##.#?

sec*_*ecJ 8 perl perl5

我见过几个职位是国家use 5.12.0;在Perl中默认启用了(例如,某些功能/编译指示use strict;).另一个例子是UTF-8和perl,其中声明use 5.14.0;

最适合Unicode字符串功能UTF-8处理.

我似乎记得use提供某些默认值(例如use strict; use warnings; use diagnostics;)的可用声明,但不记得具体内容.如何找出给定use 5.##.#;声明中包含的内容?例如,use 5.22.0;默认提供什么?use strict;

Thi*_*Not 10

这记录在perldoc feature:

可以使用功能包将多个功能加载在一起.要素包的名称以冒号为前缀,以将其与实际要素区分开来.

use feature ":5.10";
Run Code Online (Sandbox Code Playgroud)

可以使用以下功能包:

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
Run Code Online (Sandbox Code Playgroud)

哪里

use v5.10.0;
Run Code Online (Sandbox Code Playgroud)

会做一个隐含的

no feature ':all';
use feature ':5.10';
Run Code Online (Sandbox Code Playgroud)

等等.

自动启用限制记录在perldoc -f use:

如果指定的Perl版本大于或等于5.12.0,则使用词法启用限制use strict.