Channels ▼
RSS

Parallel

Why I Use Perl...and Will Continue to Do So


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.

Nine years ago, I move into testing, automation, and tools. Since then, Perl has become a fundamental tool in most of my development work. And I got really good at using the language. Whether writing tools to help hardware developers audit their schematics, writing factory tests, doing data extraction and conversion, or database interfacing, Perl has made my life easier. And Perl/Tk was there to create GUI interfaces for many of my tools. Of course, Perl cannot do everything, and I use it in conjunction with other languages as well: Labview, Javascript/jQuery, and SQL to build end-to-end data systems.

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

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

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.

Memory Management

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.

Modular Programming

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.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 

Video