Main Content

Hello World - in Perl 6

Archive - Originally posted on "The Horse's Mouth" - 2016-01-02 15:50:59 - Graham Ellis

Perl 6 is both functional and object oriented - continuing its classic eclecticism from earlier versions of Perl. Which is great once you know it, but a bit frightening when you first come to learn it!

Programming courses start with a "hello world" example - no matter what langauge is being taught - as that provides the tutor and delegates with the shortest way from entering a program, coverting it to something runnable, running it, and seeing the results.

"Hello World" in Perl 6 is ... [here].

You enter the source code into a plain text file (use your favourite text editor) ... here's what the source code may look like - use either line as I've shown 2 ways to do the same thing:

  say "Hello Perl 6 world";
  "Perl 6 works in both a functional and an OO way".say;


You can then run it using "perl6" followed by the file name you chose

  WomanWithCat:perl6 grahamellis$ perl6 hello.pl6
  Hello Perl 6 world
  Perl 6 works in both a functional and an OO way
  WomanWithCat:perl6 grahamellis$


If you prefer on a Linux / Unix system add a #! line and change file permissions.

We can offer you Perl 6 training, starting March 2016 ... at 3 levels. If you're a newcomer to programming, it's a five day "Learning to program in Perl 6" course. If you're an experienced programmer in another language, I'm going to recommend 4 days "Perl 6 programming". If you're already experienced in a previous version of Perl, please get in touch - there will be no "one course suits all" here; we can tailor individually to your needs - and indeed do so from as early as February.