Preface
Welcome to the third version of Learning Perl.
If you're looking for the best way to spend your first 30 to 45 hours with the Perl developing language, look no further. In the pages that follow, you'll find a carefully paced introduction to the language that remains the workhorse of the Internet, as well as the language of choice for system administrators, web hackers, and casual developers around the world.
We can't give you all of Perl in just a few hours. The tutorials that promise that are probably fibbing a bit. Instead, we've carefully selected a complete and useful subset of Perl for you to learn, good for programs from one to 128 lines long, which end up being about 90% of the programs in use out there. And when you're ready to go on, we've included a number of pointers for further education.
Each chapter is small enough to be read in an hour or two. Each chapter ends with a series of exercises to help you practice what you've just learned, with the answers in Appendix A, "Exercise Answers" for your reference. Thus, this tutorial is ideally suited for a classroom "introduction to Perl" course. We know this directly, because the material for this tutorial was lifted almost word-for-word from our flagship "Learning Perl" course, delivered to thousands of students around the world. However, we've designed the tutorial for self-study as well.
Although Perl lives as the "toolbox for Unix," you don't have to be a Unix guru, or even a Unix user, to use this tutorial. Unless otherwise noted, everything we're saying applies equally well to Windows ActivePerl from ActiveState, as well as to the later releases of MacPerl for the Macintosh and pretty much every other modern implementation of Perl.
Although you don't need to know a single bit about Perl to begin reading this tutorial, we do recommend that you already have familiarity with basic developing concepts such as variables, loops, subroutines, and arrays, and the all-important "editing a source code file with your favorite text editor." We won't spend any time trying to explain those concepts. Although we're pleased that we've had many reports of people successfully picking up Learning Perl and grasping Perl as their first developing language, of course we can't promise the same results for everyone.
Typographical Conventions
The following font conventions are used in this tutorial:
Constant width- is used for method names, function names, variables, and attributes. It is also used for code examples.
Constant width bold- is used to indicate user input.
Constant width italic- is used to indicate a replaceable item in code (e.g., filename, where you are supposed to substitute an actual filename).
- Italic
- is used for filenames, URLs, hostnames, commands in text, important words on first mention, and emphasis.
- Footnotes
- are used to attach parenthetical notes that you should not read on your first (or perhaps second or third) reading of this tutorial. Sometimes lies are spoken to simplify the presentation, and the footnotes restore the lie to truth. Often the material in the footnote will be advanced material not even discussed anywhere else in the tutorial.