4

有没有办法让 Perl 6 不需要my声明变量?我试过这个:

#!/usr/bin/perl6
no strict;
no warnings;

$z = "hello world";
say $z;

但这没有用

===SORRY!=== Error while compiling ./helloworld.pl
Variable '$z' is not declared
at ./helloworld.pl:5
------> $z⏏ = "hello world";
    expecting any of:
        postfix

编辑:这是 Rakudo 中的一个错误。请参阅 Perl 6 规范:http ://design.perl6.org/S01.html 官方的 Rakudo 包似乎很快就过时了。建议从源码编译:http ://rakudo.org/how-to-get-rakudo/

4

1 回答 1

4

no strict;于 2014 年 10 月实施。

请参阅:https ://github.com/rakudo/rakudo/blob/nom/docs/ChangeLog#L547

但是没有no warnings;,因为无论如何都没有发出很多警告。大多数情况下,事情被认为是正确的或错误的。我们很少决定发出警告。

于 2015-10-09T19:19:11.767 回答