Perl 101


If you think Perl is a relic from the '90s, think again. This language is still going strong.

If you've heard about Perl these days, you may think that it's a relic of the '90s, like acid-wash jeans or portable CD players. Nothing could be further from the truth. In fact, despite its age, Perl is still a very powerful and popular programming language with a great community.

Don't believe me? Here we'll take a look at Perl's past – and its future. (Get some background reading in Computer Programming: From Machine Language to Artificial Intelligence.)

What Is Perl?

Perl stands for Practical Extraction and Report Language. The name reflects its original use for text processing. Perl is a scripting language, which means its main use is for automating system tasks and controlling applications. Superficially, it most resembles C in its syntax, but borrows from a lot of other languages.

Perl's History

Perl was created by Larry Wall, a system administrator who was working for NASA's Jet Propulsion Laboratory in 1987. That actually makes it relatively young by programming language standards. C, the language in which Perl is written, has been around since the early '70s, while COBOL dates back to the 1950s.

Wall needed to implement a configuration management system using Digital Equipment Corporation VAX machines communicating via modem on opposite sides of the country, but the Unix tools were too primitive at the time. Instead of coding up an application in C, in a bit of inspired laziness (one of the key virtues of a programmer, according to the Perl community), he simply invented a new programming language instead.

Version 1.0 was released in December 1987, and it spread like wildfire among the nascent internet community. It was initially used as a system administration tool for jobs that were too complex for a shell script but not worth writing in C.


Perl's popularity got another shot in the arm with the growth of the internet and the World Wide Web, in particular. Perl was perfect for talking to databases, and many web programmers used it to implement dynamic websites, although PHP seems to have muscled into Perl's territory. (Learn more about this language in PHP 101.)

As of 2017, the most current version of Perl is Version 5, which is still being improved despite being introduced three decades ago. Wall and the Perl developers are hard at work on Perl 6 as well.

Perl's continued success is shown by the length of its documentation. The original man page runs to about 15 printed pages. Now it's been split into many pages, covering everything from basic syntax to regular expressions to the object system. There are also a number of books available on the language.

Why Perl Is (Still) Popular

The reason Perl continues to thrive is its extreme versatility and flexibility. The motto of the Perl community is "There's More Than One Way To Do It," or TMTOWDI (pronounced "Tim Toady").

Perl doesn't force any particular programming style on programmers. You can solve your problem using procedural programming, as you would in C, or using object-oriented programming, or any way you wish, really. You can use it as a replacement for shell scripting, much as Perl was traditionally used, or to build complex applications. It's available for nearly every operating system ever made. If you're using a Linux or Unix system, it's probably already pre-installed.

Because Perl's creator, Larry Wall, comes from a linguistics background, he also designed the language to be forgiving. Much like a foreigner with a heavy accent and less-than-perfect syntax can be well understood, Perl attempts to do the same thing through a principle called "Do What I Mean" (DWIM).

The language also doesn't enforce any particular indentation style, as Python does. That means you can indent blocks as you see fit, as you can with C.

Perl is designed so that anyone with some programming experience can pick it up and get productive almost immediately.

The other major feature is Perl's large library support. The hub for libraries is CPAN, or the Comprehensive Perl Archive Network. You can find libraries for doing just about any programming task you can think of, from text processing to complex mathematical analysis.

Perl's Pitfalls

The main pitfall of Perl is its main advantage: flexibility. Because Perl gives you a lot of freedom in how you can structure your program, it's very easy to create a program that, if you go back and look at it six months later, you'll struggle to remember what it does.

On the other hand, the Perl community has developed some best practices to mitigate this problem. Just remember that just because you can write your program one way doesn't mean you should. It's best to stick to simpler algorithms, use self-explanatory variable names and use good comments.

There's one other drawback too. Because it's a scripting language, the code in Perl is visible to anyone who wants to see it, which can be a problem if you don't want people to steal your application code.

Learning Perl

There are a number of ways you can learn to use Perl. One of the most popular books is "Learning Perl" by Randal L. Schwartz. Another good one, "Modern Perl," is available online for free and attempts to negotiate around Perl's pitfalls. "Programming Perl," which includes Larry Wall as one of its authors, is considered the bible of Perl. It's better suited as a reference, although it includes a tutorial.

If you're interested in learning Perl or getting reacquainted, there's a great community, including forums, websites and IRC channels, as well as the books mentioned above. Remember, there's more than one way to experience Perl. And maybe you should. It may be old, but it isn't going away any time soon.


Related Reading

Related Terms

David Delony

David Delony is a Bay Area expatriate living in Ashland, Oregon, where he combines his love of words and technology in his career as a freelance writer. He's covered everything from TV commercials to video games. David holds a B.A. in communication from California Sate University, East Bay.