10.6. Perl

Perl is a powerful scripting language introduced by Larry Walls in 1987. One of the underlying philosophies of Perl is that there should be many ways to do the same thing, allowing scripters to choose the approach that suits them the best. This can make for some very different styles of programming. It is not uncommon for a regular user of Perl to come across code from another developer and not be able to make heads or tails of it. For that matter, it is not unusual for a Perl hobbyist to come across code that they themselves have written 6 months previous and not be able to make heads or tails of it.

Perl code itself looks something like a cross between C and a Chinese grocery list. The basic syntax is in the C tradition, with code blocks enclosed in curly braces and line endings delineated by semicolons. Perl adds to this basic syntax a wide variety of symbols, each with its own special meaning. These symbols can make Perl code very compact because you can avoid temporary variables, but it takes some time to learn what they all mean. Until you do know what they mean, Perl source code can appear like some form of encryption.

10.6.1. Why Perl?

As Perl matures, it gains more and more functionality, but it began as basically the scripting equivalent of C. It did not have any OO features, but did provide functions, and more powerful data containers like arrays and hashes (dictionaries). String manipulations were central, with regular expressions built into the language ...

Get Beginning Mac OS® X Programming 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.