Perl: 'use 5.014' 启用了哪些具体功能?

标签 perl

“使用 5.014”到底能实现什么功能?

请有人复制并粘贴到这里,因为我在任何 perldoc 中都找不到它。 (也许我是瞎子)。在“perldoc 功能”中,只有 5.10 的一些内容。或者给我指向某个网址。

谢谢。

编辑:

请先检查一下,您回复了什么。例如:试试这个:

use 5.008;
$s=1;
say "hello";

您将收到有关“say”的错误消息,因为 perl 5.8 不识别“say”

之后,试试这个:

use 5.014;
$s=1;
say "hello";

你会得到错误

Global symbol "$s" requires explicit package name 

因此,“使用 5.014”启用 使用严格,以及使用功能“say”; - 默认

最佳答案

此外what raj correctly said有关在旧版 Perl 中使用 use 5.014 时收到的错误消息,您可以阅读 source code of feature 找到启用的功能列表。 。相关部分位于顶部附近:

my %feature_bundle = (
    "5.10" => [qw(switch say state)],
    "5.11" => [qw(switch say state unicode_strings)],
    "5.12" => [qw(switch say state unicode_strings)],
    "5.13" => [qw(switch say state unicode_strings)],
    "5.14" => [qw(switch say state unicode_strings)],
);

严格位部分埋藏在解释器本身的代码中更深一些。如果你查看 pp_ctl.c for tag v5.11.0 :

/* If a version >= 5.11.0 is requested, strictures are on by default! */

if (PL_compcv && vcmp(sv, sv_2mortal(upg_version(newSVnv(5.011000), FALSE))) >= 0) {
    PL_hints |= (HINT_STRICT_REFS | HINT_STRICT_SUBS | HINT_STRICT_VARS);
}

关于Perl: 'use 5.014' 启用了哪些具体功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6410492/

相关文章:

perl - POP3 是否区分已读和未读邮件

perl - DBD::SQLite::st 执行失败:数据类型不匹配

linux - 选择缺失序列号周围的线条

perl - 为什么 Perl 压缩我的数组?

perl - 在 Perl 中处理美元计算的最佳技术是什么?

python - 是否有 YSlow 的 Perl 替代品?

perl - 我的 Mysql DB 插入调用突然无声地失败

perl - 如何在普通程序代码中使用 perl 调试器漂亮地打印散列?

perl - 为什么我的 Perl 程序在 fork 之后不收割子进程?

linux - 从 shell 脚本调用脚本 - 找不到获取命令