The Exercises

These exercises are intended to help you consolidate what you have read, and to get you writing Perl scripts. They are arranged by chapter, so that an exercise given under Chapter x should only need information provided in Chapters 1 to x, unless the exercise requires you to do some extra research, in which case the necessary pointers are provided. Questions marked with a § sign are simple drill exercises and should not take you more than a few minutes; those marked with an asterisk (*) are substantial programming projects, which you might prefer to omit if you have projects of your own to work on. The unmarked exercises lie in between: they all require some thought and, usually, the writing of a Perl script. They vary in difficulty but, in general, as the material covered in the book gets more complex towards the end, so too do the exercises. (If some of the exercises appear to be marked with the string  , it's time you upgraded your Web browser.)

I have provided some test data for a few of the exercises, and also some hints and a few solutions in case you are totally stuck, but, please remember that there are no best answers to these exercises; if you are happy with something, and it works, that's fine. If you can, you should experiment with different solutions, to get a feel for how you like to use Perl. Be ambitious, do more than you think you can. Be daring, push the language to its limits if you need to. But try to have some sort of fun.

Work through the exercises by chapter, or go straight to:

Alternatively, download the exercises as they appear in the book in PostScript (545Kbytes) or PDF (Acrobat) (154Kbytes).
Perl: The Programmer's Companion