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 中识别空字符串

perl - perl中的 "keys %+"是什么意思?

java - 寻求帮助,使用 java 类的参数调用 perl 脚本

regex - 提高查找两个列表的自定义交集的 perl 代码的性能

perl - 如何为基本的 http 身份验证设置用户名和密码?

Mac OSX 上的 Perl 位置

perl - PostgreSQL、perl 和 dojo 特殊字符问题(æ、ø 和 å)

regex - 使用 golang 解析 Perl 正则表达式

Perl:从 'system' 命令捕获正确的返回值

mysql - 尝试安装 Perl-Mysql DBD,找不到 mysql_config