There are many different partial implementations of Perl 6; at the moment, the most complete is Rakudo. There are a number of different ways to get it up and running, but if you have any interest in tracking or helping with the development, the best approach is to download directly from the source repositories and and build your own copy.
To do so, you will need Subversion (svn), git, Perl 5.8 or newer, a C compiler, and a make utility. On standard Linux-like systems (including OS X), you can build it like this:
$ git clone git://github.com/rakudo/rakudo.git $ cd rakudo $ perl Configure.pl --gen-parrot $ make $ make test $ make install
Subversion is needed to run –gen-parrot — it actually uses svn to get the appropriate version of parrot and then compile it. You will need to use the appropriate make command for your system. (It’s generally nmake
with MS Visual C++, I believe.)
For current Rakudo, make install
doesn’t install into your path, it merely preps the system so that you can run the perl6 executable (created in the rakudo directory) from any other directory on your system. Once you have it going, you can easily play around with Perl 6 by executing perl6
with no arguments, putting you into a REPL environment where you can type commands and see what they do. This can be incredibly handy for trying to figure out how Perl 6 works. For instance,
$ ./perl6 > say "Hello world!"; Hello world! > say (10/7).WHAT Rat() > say [+] (1..999).grep( { $_ % 3 == 0 || $_ % 5 == 0 } ); 233168
The lines starting with $ and > are what you type; the other lines are Rakudo’s response. The first example is a simple say
statement. The second creates a rational number and asks WHAT
its type is (Rat
). The third takes the list of numbers from 1 to 999, filters out the ones not divisible by 3 or 5, sums them, and then says the result. (This is Project Euler Problem #1, thanks to draegtun for reminding me of it.) We’ll try to explain how these things work in a future post.
One last thing. If you have any difficulties getting Rakudo working, the #perl6 channel on irc.freenode.net is usually very helpful.