Chapter 41. Perl

High-Octane Shell Scripting

Perl[1] is an ecclectic, interpreted language with deep roots in Unix. It was originally written by Larry Wall, creator of other Unix staples such as patch and rn, to help with system administration tasks. Because many of its variables are prefixed with $, Perl often looks like an awk program or even a Bourne shell script. Like all appearances, this too can be deceiving. Perl is a complete programming language that supports both structured and object oriented programming. Getting started with Perl is easy, since many of the Bourne shell tricks you’ve seen will work (after a fashion) under Perl. As your knowledge grows, you’ll find that Perl will help you scratch increasingly obscure itches. Because Perl has been ported to many different platforms, it brings a Unix-like API to whichever operating system is hosting it. Perl makes cross-platform programming a reality.

The complete guide to Perl is O’Reilly’s Programming Perl, a book that weighs in at over 1500 pages. Therefore, only the barest of essentials can be presented here to help you identify your Perl installation, tinker with existing scripts, and install new modules. Luckily, Perl always comes with documentation that can be accessed through the perldoc (Section 41.10) system.

— JJ

Checking your Perl Installation

Go to http://examples.oreilly.com/upt3 for more information on: perl

Get Unix Power Tools, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.