Making things easy through Perl

I want to be known as a social activist who uses Perl. Are there any in this doggone world? It sounds outlandish, yes, but that’s just me. Besides, there are two kinds of human beings in this planet: the freaks and those struggling not to be freaks.

My interest in Perl started when I was a budding Linux enthusiast in 2001. Although, the interest did not immediately morphe into an expertise because I was too tied to my work then. (I was in a work transition from IPD to PEACE.) I can’t imagine myself hacking on a terminal while I’m busying myself with writing terminal reports.

But I couldn’t resist it. Linux is to blame because with it goes my curiosity as to what makes the free operating system stick after all the years. Perhaps, my experience in VBA programming (Microsoft Access flavor) fed into my continued passion for tinkering with codes to automate things. But of all the programming languages, why Perl?

use heart;
my $learning = undef;
my @apps = ();
foreach (@apps) {$learning++;}

A typical programmer surely understands that poetic code. I found Perl cryptic at first. I felt like having to wander far to look for the treasure trove containing the secret to understanding Perl. But as soon as I started to use my heart (sounds corny, right?), and understand the fundamentals like the basic variable types (scalar, array, hash) and regular expressions, I began to feel like focusing more on my coding objective than being bogged down by my learning of the language.

Until of late, social activism and hacking have been two separate worlds. The two have crossed paths when the software development industry became highly commercialized and politicized and when the digital age was criticized for its contribution to social divides. Thus, the birth of the Richard M. Stallman-led free software movement and other free-software-inspired communities like Linux users groups, Open Source Initiative, Alliance for Progressive Communications, and Creative Commons.

I can say that I’m a manifestation of that phenomenon, modesty aside. I do activism (though no longer going to the streets as often as I used to) and use the ICT (basically gadgets and the Internet) to facilitate and spread that activism. But why in a hell am I using Perl?

I use Perl because it’s a great tool to process text data. I remember when I had to translate an NSO dataset (not in spreadsheet but in raw text format) into our database. The manual solution could be to print out the dataset and ask someone to encode it through a user interface. But I was emboldened by the fact that Perl is an expert in processing text files and producing reports from out of them. So I tried to learn Perl and create a script to do the task.

I also created a Perl script for my collection of words that I’ve learned. With it, I can add an entry and look in it for particular words I’d like to retrieve. Then, as I posted here, I created a script to automagically rearrange a list of disordered names according to lastnames.

The latest adventure I had with Perl was in relation to my blog. I wanted to keep a local database of all my blog entries. So I created a perl script to convert the XML-formatted backup to CSV, which I used to export the entries to my PostgreSQL-based database. Then I wanted to keep local log of visits to my blog entries, so that I can assess which entries are popular and have ideas on how to improve my blog. So I wrote a Perl script to do so. On daily basis, here’s what I do:

  1. Open the blog page showing entry hits on a particular day.
  2. Select and copy the list of entries with the corresponding numbers of hits.
  3. Paste the copied list into an editor buffer and save it.
  4. Run the Perl script, which asks for the date of the hits report. The local database is then updated.

Surely enough, Perl will be there to help me automate more things. I’m bent to use it not only for text-processing tasks but also for system administration and web programming. And I’ll not run out of a string of beads called Perl.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s