Perl - The Swiss Army Knife for the Administrator
Discussion and techniques used in working with Perl as an administrator.
Introduction
Eventually, the administrator will need to take a pile of text oriented data and “dice and mince” it in order to evaluate it or format it into a simple report. Shell scripting is a bit crude, but handles dicing up single lines of output from some command and culling out information in order to use it in some other form.
Perl is an excellent “Swiss Army Knife” of the script oriented languages. It shines when you have the need for decomposing unstructured data in order to make sense of it and report on it. This is my first tool to go to for collapsing a collection of related data within groups of collections (e.g. parsing through LDIF or XML formatted data).
Perl is an evolving language though very mature that is still well supported. Object orientation is rather crude and a backport somewhere in version 4 or 5 though a foundational design feature in version 6. “Moose” is a package that was developed to simplify the usage of the klunky perl object orientation though version 6 (aka “Raku”) has been release and will likely deprecate “Moose”.
Perl is modular, it is highly and easily extendible. There is a very rich ecosystem at CPAN.org that actively supports packages that extend the base functional capability of Perl. The downside when comparing Perl with other robust scripting languages, is how it lags behind in the packages incorporated into the base installation that support modern needs.
My Experience
I’ve worked with Perl version 5 for a lot of years for performing data mincing operations. Most significantly I’ve interfaced with LDAP to extract directory information or used it to traverse a file system tree to perform a listing that summerize how much data is stored at each descending level with an overall summary at the top level.
I experimented with using the multi-threaded capability but found it didn’t yield much of a time saver when compared to a single thread run over the same data. It was likely a contention issue on the CPU, though it was thread ready.
Here are some other articles on Perl subjects:
Traditionally, a developer has been conditioned to create temporary databases or temporary working files outside of program code to leverage “database oriented” operations. In Perl, the technique for leveraging arrays defined and stored inside another array is scary for the novice developer.
Last modified February 25, 2021:
version 2.0 (70b449f)