Chapter 1. Introduction
This chapter is the big picture view of the language; don’t worry if you don’t understand everything that’s going on just yet. Worry if you get to the end of the book and you still don’t! There’s much going on, so you’ll spiral around some topics, revisit others, and with some practice see how it all fits together—it really is all about the practice.
Why Perl 6?
For starters, you have Learning Perl 6. You might as well get your money’s worth by using the language!
But what makes this an attractive language? The Perl family has always been fond of DWIM—Do What I Mean. Things that you do frequently should be easy to do, and the hardest things should still be possible. The usefulness of any programming language is measured by the extent to which it solves your problems.
Perl 6 is a great text processing language—possibly even better than Perl 5. The regular expressions (Chapter 15) have many new and exciting features that make it even easier to match and extract bits of text. The builtin grammar (Chapter 17) features allow you to easily write complex rules to handle and react to text.
Gradual typing (Chapter 3) allows you to annotate variables with restrictions about what you can store there. For example, you can specify that a number must be a whole number, or a positive number, or between two other numbers. You don’t have to use it (that’s the gradual part). You’ll be able to annotate what a subroutine accepts and what it should return. That can quickly reveal ...