Appendix F. Perl Primer

This appendix provides a brief and gentle primer to Perl. I'm using one of my Perl scripts as an exemplar and launching point to discuss the language.

Introducing Perl

Perl was invented by Larry Wall in the late 1980s. He needed a language that would give him more power than shell scripting, but require less formality than more structured languages such as C.

Hence, Perl was born, a language that you either love or hate—I've rarely found anyone in the middle. Whatever your feelings about it, it's an incredibly useful glue language used by system administrators worldwide.

Your Mac OS X system should come with the latest version of Perl installed—it's fairly easy to verify, too, just by using the following command line:

perl -v
This is perl, v5.8.8 built for darwin-thread-multi-2level
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2006, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

If you don't get this response, or if you have a very old version of Perl (say, Perl 4), then use Fink to update your copy. Chances are good, though, that you'll have everything you need to get ...

Get MAC OS® X UNIX® Toolbox: 1000+ Commands for the Mac OS® X 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.