Perl 6
Perl 6 Tutorial Part 1: Revision 14

Motivation for a new Tutorial

Perl 6 appears slowly before the wondering eyes of the curious, but if they grab Rakudo and the dokumentation (aka synopses) and try to write there first programs, they often don't get too far. The languages changes a bit every week and Rakudo nor Pugs know every command. The synopses aren't an easy read either. They are huge and contain a lot of nifty words. More written to clear edge cases to computer science students than to help the noobs to get a grasp. Therefore we would need a tutorial that introduces the reader slowly into the world of Perl 6 and prerequests as little knowledge as possible. Of course some basic Perl 5 wisdom is needed but everything else will be explained on the way. Every chapter of this tutorial is focused on one topic and containes many examples so you can start to play with the language, which I encourage you to do. Because it takes time to lern Perl and the new generation is optimized even on that.

Hello Perl 6

Nearly every introduction starts with a "Hello World" example. I tried to come up with something more original, but its still the smallest, simplest program that does something joyfully useful. So let's start with something worn out?, no something well-tried:

say "Greetings, earthlings, err Perl 6 neophytes.";

Dieses erste Programm gibt doch tatsächlich den genannten Text aus. Der Befehl say entspricht dem bekannten print, fügt aber noch ans Ende der Ausgabe einen Zeilenumbruch an, der dem Standard des aktuellen Betriebssystems entspricht. Klar gibt es 'print' weiterhin, aber zur Gewöhnung wird ab jetzt say verwendet. Ich kann aber bereits die Einwände der erfahreneren Perlschreiber hören: Ein gutes Skript beginnt mit strict und warnings. Und recht haben sie. In Perl 5 müsste das kleine Programm lauten:

Perl 5:

use strict;
use warnings;

print "Greetings, earthlings, err Perl 6 neophytes.\n";

Aber in Perl 6 entfällt das, weil beide Pragmas jetzt standardmäßig aktiviert sind. Das spart nicht nur die 2 Zeilen Code, die in fast allen meiner Programme sind, sondern es hilft jenen, die nichts darüber wissen, potenzielle Probleme eher zu sehen. Bei Bedarf kann ja beides, wie bekannt, mit no strict; und no warnings; abschaltet werden.

Overview | Next Chapter

Upload Files

Click "Browse" to find the file you want to upload. When you click "Upload file" your file will be uploaded and added to the list of attachments for this page.

Maximum file size: 50MB

File Name Author Date Uploaded Size

Save Page As

Enter a meaningful and distinctive title for your page.

Page Title:

Tip: You'll be able to find this page later by using the title you choose.

Page Already Exists

There is already a page named XXX. Would you like to:

Save with a different name:

Save the page with the name "XXX"

Append your text to the bottom of the existing page named: "XXX"

Upload Files

Click "Browse" to find the file you want to upload. When you click "Add file" this file will be added to the list of attachments for this page, and uploaded when you save the page.

Add Tags

Enter a tag and click "Add tag". The tag will be saved when you save the page.