Perl:它的确切功能是什么;使用5.014';使可能

Perl:它的确切功能是什么;使用5.014';使可能,perl,Perl,“use 5.014”究竟启用了什么功能 请,有人复制和粘贴在这里,因为我无法找到它在任何perldoc。(也许我是瞎子)。在“perldoc功能”中,只有5.10的一些功能。或者给我指一些URL 塔克斯 编辑: 请先核对一下,你的答复是什么。例如:尝试以下方法: use 5.008; $s=1; say "hello"; use 5.014; $s=1; say "hello"; 您将得到关于“say”的错误消息,因为Perl5.8不知道“say” 之后,请尝试以下操作: use 5.00

“use 5.014”究竟启用了什么功能

请,有人复制和粘贴在这里,因为我无法找到它在任何perldoc。(也许我是瞎子)。在“perldoc功能”中,只有5.10的一些功能。或者给我指一些URL

塔克斯

编辑:

请先核对一下,你的答复是什么。例如:尝试以下方法:

use 5.008;
$s=1;
say "hello";
use 5.014;
$s=1;
say "hello";
您将得到关于“say”的错误消息,因为Perl5.8不知道“say”

之后,请尝试以下操作:

use 5.008;
$s=1;
say "hello";
use 5.014;
$s=1;
say "hello";
你会犯错误的

Global symbol "$s" requires explicit package name 

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

使用x.x.xpragma会打开一些功能,并且很容易测试:

#!/usr/bin/env perl
use warnings;
use 5.14.0;

say "hello world!"
运行良好;输出“你好,世界!”

火烧死亡;输出此错误消息:

Unquoted string "say" may clash with future reserved word at foo line 5.
String found where operator expected at foo line 5, near "say "hello world!""
    (Do you need to predeclare say?)
syntax error at foo line 5, near "say "hello world!""
Execution of foo aborted due to compilation errors.
但是,我不能100%确定从5.14.0开始启用了哪些功能。我相信您会得到
say
state
switch
unicode\u字符串
strict
,除了关于使用
将5.014
与较旧版本的Perl一起使用时会收到的错误消息之外,您还可以找到一个能够读取。相关部分位于顶部附近:

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)],
);
严格位部分在解释器本身的代码中隐藏得更深一些。如果你调查:


在较新的Perls中(我想从5.10开始)
use 5.x
做了一个隐式的
use特性:5.x'
读取perldeltas for&,我看到5.12中添加了一个与unicode相关的特性,但5.14中似乎没有添加任何新的指针。

Thanx。只是在源代码中看不到“use strict;”。回答得很好-感谢您找到有助于指定每个捆绑带来的内容的源代码。一个问题:
strict
也是自动启用的(我记得从5.12开始)。你知道在哪里/什么时候完成吗?(据我所知,
feature
的源代码中没有列出它。太棒了-谢谢。(你的答案应该是可以接受的。)THANX为我指出了“delta”,其中:使用版本号大于或等于5.11.0的use-VERSION语法将在词汇上启用严格限制,就像use-strict一样(除了启用功能外。)THANX!!!还可以查看以下答案: