Hands-On Introduction to Perl

Length: 2-3 days

Prerequisites: Students should have at least one year of experience in programming some general purpose, procedural language, such as Fortran, Basic, Lisp, ksh, sh, Pascal, C, C++, etc. Students should also have basic familiarity withthe Unix environment, including how to use an editor program to create files. Attendees need not have experience with Perl.


Introductory Perl training is usually structured as a sequence of lectures. After a 45-minute lecture, the class does lab exercises for another 45 minutes or so. These are several problems with this. The biggest one is that nobody likes to sit through a long lecture, and most people can't pay attention to a long lecture, especially after lunch.

No class has students that all work at the same pace. Either the faster students get bored during the lecture, or the slower students get lost. During the exercises, the same thing happens. The fast students finish the exercises right away and are left with nothing to do; the slow students don't have enough time to work on the exercises.

Hands-On Perl provides a solution to these problems. Instead of alternating lectures and labs, the lecture runs continuously. Each slide has an example on it. Students try out the example while the lecture is going on. The lecturer suggests changes to the example, and the students try out the changes and see the effects immediately. Some slides have exercises. Students work the exercises while the lecture is going on. Occasionally the instructor will pause to let the class finish trying an example.

The dozens of examples are central to the class. Rather than having a 'strings' unit, and showing all of Perl's multitude of string functions one after the other, as many introductory classes do, this class immediately starts with simple example programs that deal with strings. As the class progresses, the examples become more elaborate, and new string functions are introduced as they are needed to solve specific problems. All of Perl's major features, including arrays, hashes, regexes, and subroutines, are treated the same way. Students remember things better when they have a context into which they can place the new information. More sophisticated uses of these features build on the simpler examples from the earlier sections that the students have already assimilated.

Students find it easier to pay attention and engage the material when they are involved in what's going on instead of passively absorbing a lecture. Advanced students try the examples quickly, but a natural path of exploration presents itself and the student continues to develop the example until it's time to move on to the next slide---usually less than two minutes.

Since the slide set is loaded on the students' workstations, any student can return to an old slide or skip ahead without disturbing the others.


Example Code

I have made all the example code from the class available online.

Return to: Universe of Discourse main page | Perl Paraphernalia | Other Classes and Talks