You Used Perl to Write WHAT?!

Every programming language has its strengths...and its weaknesses. We identify five tasks for which perl is ideally suited, and four that...well, really, shouldn't you choose something else?

By James Turner
Thu, January 24, 2008

CIO — We all know that when faced with a job to do, we usually tend to reach for the most familiar tool in our belt. And while perl is certainly a versatile tool, it isn't the right tool for every job.

Perl is the granddaddy of the open-source scripting languages, with the 1.0 release seeing the light of day way back in 1987. By comparison, PHP wasn't released until 1994, and Python didn't have its 0.9 release until 1991—only the Unix shells themselves have an older pedigree. The O'Reilly "Camel" book (Programming perl) has been a ubiquitous presence on cubicle bookshelves for decades.

Like any language, perl has its strengths and weaknesses. With that in mind, here's some recommended uses and abuses of the elder statesman of scripting.

The Good

  1. Pattern matching: Perl's greatest claim to fame has always been the tight integration of regular expressions into the base language syntax. For most developers, perl was the first time they ever used a regular expression.

    As a result, perl has always been the go-to language for any task that involves pattern-matching input. A typical use of this capability is to scan an input stream for name/value pairs and split them. Another is parsing log files with a fixed but variable length format. It's not for nothing that a lot of the popular log file auditing packages are written in perl.

  2. In-place editing: Combine regular expressions with the ability to edit files "in place" from the command line, and perl makes a dandy tool for performing a batch modification on a group of files. For example, suppose you have renamed the /home/george directory to /home/curious, and want to update a few hundred scripts in the /usr/lib/yellowhat directory to point at the correct new path. The following one-liner will do just that:

    # perl -i.bak -p -e "s#/home/george#/home/curious#" `find . -print`

    Now, this is a fairly simple example and could have easily been done using a tool such as sed, but the important thing is that you could have used any arbitrarily complex perl program as the filter, and done highly complex manipulations. Imagine an area code getting split and having to replace a single area code with one of two depending on the original exchange in hundreds of files. In perl, it would be a snap.

  3. A replacement for shell scripts: One of the worst things about shell scripting—whether in bash, sh or csh—is that the syntax of the scripts themselves is fairly hard to read. By using perl as a scripting language instead of a "traditional" shell, you can use much more C-like syntax without sacrificing functionality.

  4. As a database manipulation tool: One of perl's strengths has always been the strong database interoperability through the DBI and DBD libraries. If you need to create a quick database report, or convert between a database and some other form of data storage, you can very easily whip up a little utility using perl in very short time.

  5. As a cross-platform language: Because perl is interpreted, perl scripts don't need to be recompiled when moved from platform to platform. And because companies like ActiveState have produced strong ports of perl to platforms such as Windows, most perl programs will run without modification even if they do advanced things such as database connectivity, file system modification or network programming.

Continue Reading

With 1.5 billion instructions in one second (BIPS), while consuming less energy than ever before, Wintergreen Research says IT departments need to sit up and take notice of this hybrid system that combines the System z with servers.
Learn how your answer to this question compares to your peers by taking this quick poll. See how your peers are dealing with the challenge of ensuring a highly capable server infrastructure as technological shifts impact the application server platform.
With increasing data growth, comes increased need for data security.  The existing DLP model, with a focus on compliance/enforcement is not sufficient as the data discovery and classification capabilities are not granular enough.  Read this paper to find how you can efficiently and accurately manage your risk by rapidly inventorying and classifying your data and then developing remediation workflows that support business needs. 
This paper breaks down attack sources into four categories: external, malicious insiders, accidental insiders, and unknown.
The rapid growth of data and technology is creating challenges for organizations as this digital data is considered to be business communications and must be preserved according the same industry-specific regulations governing the retention and discovery of emails and more traditional forms of electronic communications. This paper examines the role that Data Loss Prevention ("DLP") technology can play in helping organizations address the challenges of locating information in response to electronic discovery.
This research, conducted by the Ponemon Institute, focuses on issues relating to the use of data protection solutions such as endpoint encryption and data loss prevention within the workplace.
As greater numbers of datacenter servers transition from the physical to the virtual world, the components of virtualization success come to the fore. What scores of organizations have discovered is that success is derived from an optimal pairing of the right software platform with the right hardware platform.
Have you been looking to hear about customer's experiences with the new VMware vCenter Site Recovery Manager product? View this webcast to learn about VMware customer, Navicure, and their experiences testing and evaluating the recovery manager, their progress in implementing it in their environment and their advice other customers considering using vCenter.
Many enterprises have discovered that the use of virtualization to support desktop workloads creates a range of significant benefits. These benefits include price efficiencies, improved IT management and greater agility and choice for end users.

This VMware sponsored webcast with IDC will provide both quantitative measurement of the business value -- defined as the expected ROI -- and qualitative analysis associated with the use of VMware View™. IDC will also provide an analysis of the View Composer and ThinApp™ features of VMware View, including the business value of these solutions and an overview of how they work.

Attend this webcast to learn about:
- Challenges and barriers that might impede the adoption of desktop virtualization
- Navigating roadblocks to facilitate a strategic implementation
- Optimizing qualitative and quantitative benefits to IT and your business
VMware recently announced VMware vFabric™ Data Director, a new database deployment and operations platform that enables enterprise IT organizations to offer database as a private cloud service. Built on top of VMware vSphere 5, vFabric Data Director enables IT organizations to ontrol database sprawl through automation and consistent policy enforcement and accelerate application development cycles with self-service database management. Attend this webcast to learn how vFabric Data Director can help you build database-as-a-service in your datacenter.
A simple, cost-effective disaster-recovery solution for virtual environments is high on the agenda for IT organizations as they virtualize more business-critical applications with VMware. VMware vCenter™ Site Recovery Manager-the market-leading disaster-recovery product-ensures the simplest and most reliable disaster protection for all virtualized applications. VMware vCenter Site Recovery Manager provides centralized management of recovery plans, enables nondisruptive testing and automates site-failover processes.
Traditional disaster recovery solutions are often too expensive, complex and unreliable to meet business requirements. As a result, IT departments are hesitant to expand disaster protection beyond their most critical applications, largely because they are uncertain whether the quality of the protection is really worth its cost. VMware vCenter™ Site Recovery Manager 5 is the market-leading disaster recovery product that addresses this situation for organizations of all kinds. It complements VMware vSphere to ensure the simplest and most reliable disaster protection for all virtualized applications.
Newsletter Sign-Up »

Receive the latest news test, reviews and trends on your favorite technology topics

Choose a newsletter
  1. View all Newsletters | Privacy Policy
Resource Center