Perl 6

On debian: apt-get install rakudo.

Perl 6 does not appear to be available in the FreeBSD 10.2 ports collection.

The downloads page describes building from source (

Try ‘hello.p6’:

#!/usr/bin/env perl6
use v6;
say "Hello, Perl 6";
"Hello, Perl 6, object-oriented style".say
# A single line comment
A multi-
line comment.

Unlike Perl 5, method calls use a dot instead of ->, like: $foo.color

Unlike Perl 5, sigils are now invariable. This is huge. @array = [0, 3, 7]; @array[2]; # 7

Reading a file into an array: my @lines = “file.txt”.IO.lines;

Strict mode and warnings are on by default in Perl 6.

Since strict is in effect, variables are declared with ‘my’ for lexical local scope: my $x = ‘foo’; say “My x is $x.”;

(‘say’ is like ‘print’, but appends a platform-appropriate newline.)

To get user input, use ‘prompt’, which does ‘say’, reads STDIN, and chomps: my $answer = prompt “What the answer, fool? “;

Parens in Perl 6 are only for group, so a simple ‘if’ doesn’t need them: if $answer == ‘daffodil’ { say “Yes!”; }

We have multi-line comments. Any kind of bracket works following the #. #( A long comment. )

Basic variable types: my $scalar = ‘Foo’; say $scalar; my @list = (‘a’, ‘b’, ‘c’); say @list[1]; say @list[@list.end]; my %hash = (‘red’ => ‘apple’, ‘yellow’ => ‘banana’); say %hash{‘yellow’}; my @colors = %hash.keys; my @fruits = %hash.values;