You will obviously need to install Rakudo if you want to use it. There are a couple of options, but I will focus on Rakudo Star. Rakudo Star is a distribution which includes some important libraries and an excellent book.
The easiest way to install Rakudo Star depends on your operating system. Specifically, it depends on whether you’re using Microsoft Windows.
There is a lovely Rakudo Star installer available for Windows users. It
includes all the pieces needed to get started with Rakudo. Look on the Rakudo
Star download page for a filename ending in
now, that file is
rakudo-star.2010.07.msi. It will probably be a different
file when you look.
Download that MSI file and run it. Go ahead and accept the defaults, unless you have a good reason not to.
Once you have installed Rakudo, you need to add it to your environment
path so that you can run it from the command prompt. Open your Start
menu, right click “My Computer”, and select “Properties”. Open the
“Advanced” tab, and click the “Environment Variables” button. Scroll
through “System Variables” until you see the entry for “Path”. Double
click “Path” to open the “Edit System Variable” dialog. Enter the
location of your Rakudo installation - probably
C:\Rakudo\bin - at the
beginning of the “Variable Value” field, followed by the
separator character. Click “OK” to close this dialog, “OK” again to
close the Environment Variables dialog, then “OK” one more time to close
the “System Properties” dialog.
To test, run “Command Prompt” and try
Double check your Path environment variable if you don’t see something like this.
It looks like you’ve installed Rakudo!
Of course, there’s no point installing Rakudo to a custom directory if
your shell can’t find it. Add a couple lines to your
This will make the
perl6 executable available the next time you log
in, or you can rush the process by running
Now that we know Rakudo is installed, let’s take a look at what it gets us.
What Do You Get?
Obviously, you get Rakudo. But Rakudo is built on top of the Parrot virtual machine, so you also get a fresh copy of #parrot. You can learn more about coding directly to the virtual machine at the Parrot Babysteps. And you also get NQP, which is sort of a stripped-down version of Rakudo that makes writing new languages in Parrot a lot easier.
One thing I missed in Perl 5 was a simple interactive shell. There is a
debug shell, but it’s not quite the same thing. Fortunately, Rakudo has
an interactive shell, and you start it by calling
perl6 from the
What can we do in this shell? Well, we can print things out.
We can use it as a calculator.
We can calculate the area of a circle that has a radius of ten units.
Okay, you get the idea. There is a lot we can do with the perl6 shell. Let’s start looking a little bit at the Perl 6 language.
First up is variables.
Exciting as that was, it’s time to leave the Perl 6 shell and start writing a simple script. It’s easy enough to quit the shell.
Writing a Perl 6 Program
All we need now to write a Perl 6 program is a text editor. I prefer #vim, which provides syntax highlighting.