Mimsy Were the Borogoves

Hacks: Articles about programming in Python, Perl, PHP, and whatever else I happen to feel like hacking at.

Perls before Swine Perl tutorial

Jerry Stratton, April 2, 2006

I’ve just completely revamped Perls before Swine. Perl isn’t a tutorial I teach very often, but I did one for the University on Tuesday and realized ahead of time that Swine was far too outdated. Worse, the previous version had been written for a specific group of people most of whom were long gone anyway.

The new version, rather than presenting ideas and exercises, with answers in the back, follows the standard I’ve found more useful for other books: building a useful work over several iterations.

Because most of my Perl work is for filtering data, that’s what it focuses on. It also covers symbolic references and hard references, features I’m not even sure were available when I wrote the previous version.

Rather than working on the /etc/passwd file! as the previous one did (because, at the time, you could be reasonably assured that not only would the /etc/passwd file be available, but that it would be readable by everyone!) I’m using the same sample data for tutorials that the MySQL tutorial uses.

Perl is a twenty-year-old scripting language designed for managing text. It is cross-platform, running on Linux, Unix, Mac OS X, Windows, and probably many more operating systems. It comes pre-installed on most operating systems today, and is used for managing server tasks, formatting documents, and filtering data. It may be the most-used programming language on the web, and has sometimes been called the duct-tape of the Internet.

If you’re familiar with the use of duct tape, you’ll have some idea of what Perl gets used for. Perl is not the prettiest of solutions. But it works. It holds together things that would otherwise never work together, and it is a useful tool for creating quick solutions to thorny problems. There is an elegance in duct tape, an elegance in the solutions of the trenches. When something is broken, it needs to be fixed.

It is available in RTF (from Word), HTML, and PDF.

  1. <- Learning Python
  2. Invariant sections ->