With the slogan, “There’s more than one way to do it,” Perl came on the scene as a flexible, powerful server-side language that could do more than one job. And for a number of years, Perl made very important contributions to modern web technology—especially for a language that was developed before the web even came to be.
It’s prominent on the list of back-end programming languages, has an active developer community, and stands out among other server-side scripts as one of the most popular languages used in CGI scripting. But in terms of developer popularity—arguably one of the key barometers of the health and future of a technology—it’s appeared to wane with new learners, falling behind popular languages like Ruby and Python.
So how does Perl stack up to the competition today, and how will Perl 6 play into the future of modern web development? From a hiring perspective, which developers need to know Perl, and why is it important? Here’s a look at all things Perl—where it’s been, and where it’s headed with Perl 6.
With over 27 years of revisions and changes under its belt, Perl is an older language, but it’s a solid language that performs well in the context of the web. And that’s because of its origins: Perl got its start in the 1980s as a text processing language for the Unix operating system to make report processing more efficient. As the web is based on huge amounts of text, Perl is savvy by design.
When Perl came along, it was immensely popular for a few reasons. First, it addressed a developer pain point: Languages like C were so low-level that they took many lines of code to write even the simplest processes. Also, C wasn’t portable, and Perl solved for that. Perl was big in the 1990s and was used to build web-based businesses when e-commerce was on the rise. Large sites like Amazon and Craigslist were written in Perl, and it proved equally efficient with system administration as with building complex enterprise software. So what changed?
PERL PROGRAMMING TODAY
While it’s still a powerhouse for back-end architecture, a few things have changed Perl’s popularity. First, how we do business on the web has changed. Everything from bandwidth and time to market to prototyping and cloud hosting has changed what businesses need from their websites, and newer languages evolved to meet these new demands. Scripts written in Ruby and Python allow for faster development and are geared to the web with frameworks that make building a site even more streamlined. Even Perl’s former foothold, bioinformatics (using computers to analyze biological data for gene sequencing, for example), has been taken over by Python.
Web development has also changed, propelled by shared code and modules, frameworks, templates, and open-source libraries—options that make it almost rare to build a site from scratch. This is why languages like Ruby, Python, and PHP rise to the occasion—and in popularity. With APIs, server infrastructures, and templates built in, they’re supporting the new best practices of modern development.
Also, code readability became an issue. With all of the collaboration that goes into web development today, Perl’s flexibility means the same procedure can be written in a number of ways. This poses a problem when one developer can’t decipher what another developer’s code is trying to do. With Python’s “one way to do it” method, things stay more consistent.
Here’s the takeaway: One of the main points of contention in the modern IT industry is balancing flexibility and complexity, and programming languages are at the center of this discussion. The “one way to do it” language is a nice, simple approach but lacks flexibility to get creative with solutions on the fly. Get too flexible, however, and code gets complicated. This is the Perl conversation: If you can do anything with it, is that at the cost of clean, readable code? (Answer: Not if you have a skilled Perl developer.)
Today, Perl is still really prominent—and often makes up the P of the popular LAMP stack (Linux/Apache/MySQL/Perl, PHP, or Python). Get to know a little more about this language below.
- Perl is a server-side script. Server-side scripts create the architecture and functionality of a site that you don’t see to help the client-facing part of a website you do see run smoothly and dynamically. Learn more in this Server-Side Scripting article.
- Perl is free, open-source, and object-oriented.
- It’s cross-platform and lightning fast. It was built to run on the Unix operating system but can run on over 100 platforms. And compared with other scripting languages like Python and Ruby, it runs incredibly fast and performs well handling large amounts of data.
- CPAN (Comprehensive Perl Archive Network) is a collection of thousands of Perl software modules, offering libraries of packaged code written and maintained by their own authors. One of the biggest advantages of Perl, CPAN makes it really easy to find the exact module you need, when you need it.
- The Catalyst framework: The most popular Perl framework, Catalyst is an open-source MVC framework that’s used by sites like iPlayer and the BBC.
- The Dancer framework
- Mojolicious: A framework inspired by Rails. Supports non-blocking operations and allows you to easily create and scale up web applications.
- Moose/Moo OOO frameworks: Postmodern OOO frameworks for Perl, allowing quick & easy OOO development using Perl.
- DBIx::Class: This class is a very powerful ORM/database access framework with reverse engineering and other major features.
- AnyEvent (usually with EV backend) is “a must-have” tool for making asynchronous and non-blocking operations, timers, etc.
- It interfaces well with C/C++ languages, with major syntax similarities to C and PHP.
Unix has a built-in Perl interpreter.
- It supports database integration with almost every possible relational and non-relational database, serving as the “glue” for back-end software. It’s ideal for database mining, as well.
Perl is most often used for:
- System administration
- CGI scripting
- Intrawebs and older web systems
- Data mining and statistical analysis
- GUI programming
- Web automation
- Security system prototyping
- Network prototyping
- Regular expressions in bioinformatics, widely used in the 1990s
THE FUTURE OF PERL: A POWERFUL TOOL FOR SYSTEM ADMINISTRATORS
How does the future of Perl look? There’s been a lot of discussion about Perl’s decline as a web development language, but as a system administration language, it’s got staying power. It’s still an excellent language for writing large system administration scripts. Plus, CPAN is always growing with new modules, and Perl 6 was released in January 2016.
Perl 6 introduces a major drift from original Perl 5 design, allowing much more flexibility in terms of compilation, byte code, and many other aspects.
PERL AND CGI SCRIPTING
Perl is big in the world of server technology: Alongside the C language, Perl is most often used in Common Gateway Interface (CGI) scripting. CGI scripts are programs written specifically for web servers, allowing them to do more than just read a request and send a file back to the browser.
All HTTP web servers have directories that contain a website’s files. For example, when you type in a URL with a “/index.html” at the end of it, the server sends back the file marked “.index.html.” But with CGI scripts, when a server receives a request for something more dynamic than just a pre-written page, it actually executes the request via the CGI script and returns the output to the browser. In essence, CGI scripts make servers more than file directories—they’re adaptable, smart file processors. To learn more, here’s a 3-part tutorial on CGI programming with Perl.
For now, from a hiring perspective, system administrators, database managers, and server-side software engineers continue to be skilled in Perl. More experienced developers also tend to favor it. There are numerous applications around the web written in Perl that require maintenance, and plenty of developers at the enterprise level are still actively using it.
With the release of Perl 6 it might be reasonable to expect Perl to regain popularity in a few years. This language still retains the power of flexibility, so having it in your toolbox is always helpful.