It was alarming to read in the recent article The Rise and Fall of Languages in 2012 by Dr. Dobb's editor, Andrew Binstock, that Perl was "continuing its long decline" and was in"an irretrievable tailspin," based on statistics from Google searches. Nothing in the article discussed what was lacking feature-wise in the language that might be behind this decline. While I am not an authority on programming languages, I thought it was only appropriate to reflect on the strengths of Perl that I've relied on during my 14-year affair with the language.
My History with Perl
I stumbled upon Perl back in 1999. I was an FPGA Logic Designer at Lucent Technologies proficient and programming in C, C++, and VHDL. Web Programming seemed like an exciting world and Perl was advertised as the "duct tape" that glued the World Wide Web together. After a one-day workshop at Lucent, I quickly realized that Perl was a godsend to hardware developers. It combined the power of C and AWK making it a great language for developing hardware automation tools. As a logic designer, Perl augmented my abilities by providing me with a powerful language that was easier to create tools with. I created tools for "stitching modules" for chip design and testing, and designing two-pass assembly languages customized for test benching VHDL/Verilog chip design.
The Power of Perl: 10 Good Reasons
Over the years, my fondness of Perl has only grown stronger. I write anywhere between 5,000 to 15,000 lines of NCL Perl code a year, from throwaway scripts to large-scale and robust factory test applications. The following list of the reasons I particularly choose Perl for my work might help other developers determine whether Perl is the right choice for their needs.
Regular expressions are the most compelling attraction of Perl. It is no secret that Perl regular expressions are the envy of other languages. As data continues to have an ever-growing importance in today's world, regular expressions provide us with the power to slice and dice data so that we can measure, learn, and make intelligent decisions. Good regular expressions, such as those in Perl, will therefore become increasingly important.
Hashes or content-associative arrays provide us with a quick way of creating lookup tables. And in the world of data and automation, lookup tables are indispensable for creating tools. Listing all the great ways of using hashes is beyond the scope of this article. The vast majority of my applications would not be possible without the power of Perl hashes.
A programmer's productivity is greatly enhanced by not having to manage memory allocation and deallocation. Arrays and lookup tables can grow and shrink as need dictates. Complex structures can add and remove fields on the fly.
References and Complex Structures
Serious programming requires the ability to create complex structures. Perl supports references/pointers, which is key to being able to create complex structures. Again, there is no need to pre-declare fields. Keys can be added and removed on the fly.
Large-scale programming is not possible without support for modules. While Perl can be used for pure scripting, it does enable modular programming using packages. Many of my applications consist of 20 or more modules, with each module housing a single subroutine call. Packages are also used for doing OO programming in Perl.