4
votes

Is there any way to make Perl 6 not require my to declare variables? I tried this:

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

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

But that didn't work

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

EDIT: This is a bug in Rakudo. See Perl 6 spec: http://design.perl6.org/S01.html The official Rakudo package appears to go out of date very quickly. It is recommended that you compile from source: http://rakudo.org/how-to-get-rakudo/

1
Works in my Rakudo; you presumably have an older version. ā€“ raiph
The warnings machinery works but the pragma hasn't yet been implemented. ā€“ raiph
Why would you want to do that? ā€“ Christopher Bottoms

1 Answers

4
votes

no strict; got implemented in October 2014.

See: https://github.com/rakudo/rakudo/blob/nom/docs/ChangeLog#L547

There is no no warnings; though, as there are not many warnings emitted anyway. Mostly things are considered either correct or an error. Only rarely do we decide to make something warn.