Perl

From ArticleWorld


The beauty of Perl lies in its humility. Borrowing from C, shell scripting, awk, Lisp, sed and other languages, a language has evolved into the best tool a programmer can get. The very fact that it has evolved so much should convey that Perl is now the answer to most of our problems.


It is a general-purpose language and it is more of a practical language. According to Larry Wall, languages that aim to be minimal tend to be less useful. Hence the creator’s focus on its being practical. What began as practical language became the glue language of the World Wide Web. Bio-informaticians depend on it most of the time for data and text mining.


Perl has the following procedural programming language, but supports object-oriented programming as well. It has the following features

  • variables
  • expressions
  • control structures
  • assignment statements
  • subroutines

All these features are also present in C and Java.


The variables are preceded by sigils.

Example:

  • $Variable1
  • $Variable2

This confers several advantages as far as text processing is concerned. Sigils make it possible for the variable to be interpolated in strings. They allow for the easy identification of variables. This makes learning to program in Perl much easier.


Data processing


The genius of its creator is reflected in the way data are handled in Perl. Imagine a huge segment of data. Most programming languages paste the segment onto their clipboard/notepad. With every operation, they load the entire segment onto the clipboard. This slows data processing considerably. Enter Perl. It processes the datasheet line by line. The values are ‘placed’ in the variable and processed. Then the algorithm is repeated. This is referred to as ‘on the fly’ processing some times. However, this alone is not enough to solve the problems. Perl, to keep up with growing demands, is now equipped to handle complex data types; multidimensional arrays, first class functions and object oriented programming.


A language that is easy to learn will have faster development because of the ease with which people can contribute. A language that is equipped with pipelining capabilities can be used as a glue language. This is true of Perl.


Application, implementation, datatypes


Perl has become the mainstay for financial programmers as well as computational biologists. It is implemented as a core interpreter. Its interpreter is written in C and has 150,000 lines of code.

It has three data types:

  • Scalars ($)
  • Lists or arrays (@)
  • Hashes (%)

Perl is famous among programmers for its one-liners. Perl.org and CPAN are good places to start.