Perl 6

Perl 6 is a language specification for a new version of the programming language Perl. Any implementation that passes the official test suite can call itself “Perl 6”. Several implementations exist at various levels of maturity and completeness.

These implementations have in turn influenced the design of the language by highlighting misfeatures, contradictions, or features of difficult implementation and little benefit. This process of iteration has produced a more cohesive and consistent language specification.

Implementations of Perl 6

The most complete of the implementations at the moment is Rakudo Star.

Perlito, also known as MiniPerl6 – a compiler collection that implements a (subset) of Perl 5 and Perl 6: it can compile Perl 5 and Perl 6 into another ‘backend language’ : Perl 5 to Perl 6 (v.v.), Perl 5 / 6 into Javascript, Perl 6 into Python 2.6, Ruby 1.9, Go, Common Lisp.

Why the ‘6’ in Perl 6

Perl 6 is versatile, intuitive, and flexible. It embraces several paradigms like procedural, object-oriented, and functional programming, and offers powerful tools for parsing text. Perl 6 is the newest member of the family of languages known as Perl. It represents a major break in syntactic and semantic compatibility from Perl 5, thus the increase from 5 to 6. However, this does not mean that Perl 5 is going away anytime soon. In fact, it is quite the opposite. Both Perl 5 and Perl 6 have very active developer communities which mold the languages.

Differences and similarities between Perl 5 and Perl 6

Perl 5 developers try to extend the language in various ways while keeping backwards compatibility with past versions of Perl. Perl 6 developers extend the language by adding new syntactic and semantic features that enable more power and expressiveness without the restriction of backward compatibility with Perl 5 or earlier versions.

Some might ask, “Why call it Perl if it’s a different language?” Perl is both the vagaries of syntax and a philosophy (there’s more than one way to do it; easy things should be easy, and hard things possible); Perl is custom (comprehensive testing, idioms); Perl is architectural edifice (the Comprehensive Perl Archive Network); and Perl is community (perl5-porters, perl6-language). Both Perl 5 and Perl 6 share these attributes to varying degrees. As well, Perl is syncretic. Just as Perl borrows good ideas from other languages, Perl 5 and Perl 6 share features.

A group of Rakudo Perl 6 developers are maintaining an online book. It is free and is a work-in-progress. It teaches you how to program in Perl 6. The title of the book: “Using Perl 6” (last version as of this writing: 2012.05.23 snapshot). The book is written by well-known Perl 6 developers: Jonathan S. Duff, Moritz Lenz, Carl Masak, Patrick R. Michaud & Jonathan Worthington.

All of the examples in this book run with the Rakudo Perl 6 Compiler, but they are in no way specific to Rakudo – any sufficiently advanced Perl 6 implementation can run them. Good luck and – as the Perl 6 community often says – have fun!

Run Rakudo Perl 6

To run a Perl 6 program with Rakudo, you will need to include the installation directory in your system PATH variable and issue a command like:

$ perl6 hello.pl

(this must look familiar to any Perl developer).

If you invoke the Rakudo compiler without an explicit script to run, it enters a small interactive mode that allows the execution of Perl 6 statements from the command line.

Getting involved

If you are inspired now and want to contribute to the Perl 6 community, there are some resources available to you.

A growing list of modules is published on http://modules.perl6.org/ and at the moment of writing this, the number of modules exceeded 140. Of course, this can (not yet) be compared with the immense number of Perl 5 modules on CPAN.

Nevertheless, this growing number of modules makes Perl 6 more useful by the month. Rakudo Perl has a module management tool, panda, to make your life as a module user easier.

Last year, one of the Perl 6 developers exclaimed: “There is DarkPan for Perl 6” which means he found two independent, unknown, groups of people who published some Perl 6 modules on Github. This shows that Perl 6 is in production (without the knowledge of the Perl 6 developers). It is in use.

Perl 6 is here. It exists. It is ready to be used.

Enjoy.

Wendy van Dijk is a website pioneer and Perl enthusiast since 1994. She is also busy in the Perl-community visiting (and sometimes organising) Perl meetings, including workshops and conferences, spreading the good words for Perl.