[Previous] [Contents] [Next]
A Perl5 Overview and Tutorial
- New Features in Perl5
- Extended Perl5 Tutorial
- Traps for Perl4 Programmers Migrating to Perl5
The latest major version of Perl is Version 5, and because most or all the examples in this tutorial require it, I dedicate this chapter to trying to teach you a bit about how it works and what's different about it, as compared to its predecessor, Perl4.
Perl5 is now into its third (and probably fourth, by the time this tutorial is published) public release. The early stages of development were fast-paced and difficult to keep up with, but the specifications have settled, and most of the core functionality has stabilized, both in its implementation details and in its usability.
When I refer to the major version, I mean the first number in the version specifier--for example, the 5 in 5.002. The public release number, in this context, is 002. As of this writing, Perl is currently at revision number 5.003_05. The _05 delineates a development patch suite that postdates the official 5.003 release. The next public release, 5.004, will evolve from at least one additional development patch.
In the following sections, I'll introduce you to the new features that are available to the Perl programmer using Version 5. First, we'll take an extended look at some of the more important Perl5 features, as they relate to this tutorial. Next, I'll give you a detailed explanation of reference variables, describing how they work, and what they're used for. Then we'll take an in-depth look at modules and extensions for Perl5. I'll describe how to use them, where to get them, and why you should use them in the first place. Of course, you will need to use various modules extensively throughout this tutorial, in most or all of the examples. There are, however, other, more fundamental reasons for using modules, and I'll emphasize these throughout the tutorial
I provide for you, on the accompanying CD-ROM, the latest version of the modules used in this tutorial, as of the date of the assembly of the materials on the CD-ROM. You'll need to update them as new versions are released. You can find more details on updating Perl modules and extensions later in this chapter. Also see the description of the CPAN, in Chapter 1.
Towards the end of this chapter, I'll show how you can use object-oriented techniques to implement your own customized functionality in your Perl programs that use modules or extensions, with a minimal amount of additional code. Finally, I close the chapter with a description of the "traps" to be wary of when you're using Perl5--for example, things that worked one way with Perl4 and now work differently, or not at all, with Perl5. Not too many of these traps exist, and they're documented, so don't worry too much about them, especially if you're starting from scratch and don't need to convert any Perl4 programs to Perl5.
I make some assumptions in this chapter and, as previously mentioned, in this tutorial. Namely, I must assume that you have used Perl and written programs in the Perl language. You should be familiar with most or all the Perl4 data types, operators, and syntax. Furthermore, I'm not going to try to introduce all of Perl5 here. That is in the realm of a complete tutorial, some of which have recently been released. My primary goal in this chapter is that you gain the familiarity you need to understand the examples given within this tutorial, and that you know enough when you're finished reading it to implement your own programs and Web functionality using the techniques described.
[Previous] [Contents] [Next]