Hacker News new | ask | show | jobs
by grondilu 3859 days ago
The extension is not mandatory. Usually people use .p6, but you can also use .pl . Notice that I've never seen .pl6.

'use v6;' is not mandatory either, but it allows your program to display an helpful error message if you try to run it with the perl 5 interpreter. Try "perl -e 'use v6;'", you should get:

    Perl v6.0.0 required--this is only v5.20.2, stopped at -e line 1.
    BEGIN failed--compilation aborted at -e line 1.
'use v2;' will not run with the Perl 6 interpreter, but 'use v5;' will work, as the Perl 6 interpreter is specced to be able to run Perl 5, albeit with certain limitations (no XS, for instance).
2 comments

Notice that I've never seen .pl6

Check your Rakudo's tools folder.

Understood. Thanks! I might have confused .p6 with .pl6. Thanks for the clarification on that.