The ability to manipulate arrays in Perl is just beautiful. You can dynamically add/remove elements from the end of the array using PUSH/POP, and dynamically move elements into the front of the array using UNSHIFT/SHIFT. Arrays can be indexed positively from the beginning of the array, or with negative indices from the end of the array. Building FIFOs, LIFOs, queues, and stacks is easy.
join are two built-in functions that allow for the creation and collapsing of arrays.
Splice gives us the power to remove and add elements within the array.
reverse sort allow for sorting in both directions.
Beginning programmers can easily be turned off by Perl's lack of support for multi-dimensional arrays. But the better way to create complex structures including multi-dimensional arrays is to use references (and you cannot fully exploit the power of any language without the use of references).
Smart, High Level Language with Great Built-In Functions
Perl is a high level language. It is a smart language. It simplifies its variable types to scalar, array, and hash.
We never have to worry about variable types. Perl knows when to interpret a value as an integer or a string. The right-hand side knows whether the left-hand operand is asking for an array or single-value. And using "
wantarray," you can write your own subroutine modules with similar smartness. And arrays, hashes, and structures can grow and shrink dynamically Perl takes care of it automagically.
It also supports a large number of great built-in functions. Take a look at the Schwartzian transform to see the power of sorting complex structures using the
Map function. And I love the ability to look at a variable and determine whether it is of type
%hash by the prefix.
Full Programming Language
Perl is more than a scripting language. It is a general-purpose language. It supports threads and recursion. In one application, I have 16 threads running diagnostics in parallel on a chassis in factory. Perl supports object-oriented programming, and the new Moose library automates and simplifies much of the work. And, finally, GUI support is made possible by using Perl/Tk.
CPAN, Community, and Books
Perl is an open-source language with a strong community. The Perl Comprehensive Perl Archive Network (CPAN) is a repository with more than 25,000 modules. My use of Perl today would be very limited without the ability to use modules like DBI, Excel, Telnet, FTP, Ping, and Win32:Serial Communications to name a few of the modules critical to my field of work.
Learning Perl is made easy by the many free tutorials on the web. Simply start with www.perl.org to begin the discovery and learning process. In addition, Learning Perl, Intermediate Perl, and Programming Perl are three essential books for mastering the language. In this past year, new editions of these books were released to reflect language changes. Other good books worth mentioning are Effective Perl Programming and Perl Best Practices.
ActiveState deserves special mention here. For a small fee, you can purchase a compiler that creates a pseudo executable. In deploying applications to remote sites, Active State's PDK allows programmers to compile an application into an executable. Simply drop an executable at one of the numerous factory test stations and you are done. You only need to maintain Perl Libraries at your development workstation. There is no need to worry about loading the latest libraries at every test station.
The aforementioned strengths noted for Perl may well be the strengths of other competing languages. I am not in a position to compare Perl to Python or other similar languages.
The power of Perl as outlined here relates to several domains of work related to data, tools, and automation. My experience is testimony to Perl creator, Larry Wall's statement that Perl is a language for "making simple things easy and difficult things possible." And for that reason, I hope that Mr. Binstock is wrong in his contention that Perl is in a tailspin; it's a wonderful language!
Sammy Esmail is a data, tools, and automation developer.