Perl:使用 5.##.# 中包含什么?

标签 perl

我见过好几个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/

相关文章:

perl - 使用 Perl 进行简单的 JSON 解析

arrays - 如何在 Perl 中将多个数组传递给 'foreach' 循环?

windows - 在 Windows 上的 Perl 中获取当前系统本地编码

regex - [a-zA-Z0-9_] 中的 _ 是什么意思?

Perl Tkx 示例或教程

perl - Mojolicious - 无法使用催眠蟾蜍启动应用程序

perl - 您如何自定义文本分段以在有向图之间不中断?

java - 发送邮件可以在 Perl 中使用,但不能在 Java 中使用

perl - 如何告诉 Perl 每 20 秒运行一些代码?

windows - 基于 Windows 7 上的 Perl