PERL Programming Language – Beginners Guide

October 8, 2018

PERL is a family of high-level, general-purpose, human understandable and dynamic programming languages. The languages in this family have PERL 5 and PERL 6. Though PERL is not officially an contraction, there are various backronyms in use, including “Practical Extraction and Reporting Language”. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier.

Since then, it has undergone many changes and revisions. PERL 6, which began as a redesign of PERL 5 in 2000, eventually evolved into a separate language. Both languages continue to be developed independently by different development teams and liberally borrow ideas from one another.

PERL Programming Language – Beginners Guide

The PERL Programming Language borrow features from other programming languages including C, shell script, AWK. They provide powerful text processing facilities without the arbitrary data-length limits of many contemporary Unix command line tools. Facilitating easy manipulation of text files. PERL 5 gained widespread popularity in the late 1990s as a CGI scripting language, in part due to its then unsurpassed regular expression and string parsing abilities.

In addition to CGI, PERL 5 is used for system administration, network programming, finance, bioinformatics, and other applications, such as for GUIs. It has been nicknamed “the Swiss Army chainsaw of scripting languages” because of its flexibility and power, and also its ugliness. In 1998, it was also referred to as the “duct tape that holds the Internet together”, in reference to both its ubiquitous use as a glue language and its perceived inelegance.

Early Versions:

Larry Wall began work on PERL in 1987, while working as a programmer at Unisys, and released version 1.0 to the comp. sources. Misc newsgroup on December 18, 1987. The language expanded rapidly over the next few years.

PERL2, released in 1988, featured a better regular expression engine. PERL 3, released in 1989, added support for binary data streams. Originally, the only documentation for PERL was a single lengthy man page. In 1991, Programming PERL, known to many PERL programmers as the “Camel Book” because of its cover, was published and became the de facto reference for the language. At the same time, the PERL version number was bumped to 4, not to mark a major change in the language but to identify the version that was well documented by the book.

PERL Started Version:

Perl 4 went through a series of maintenance releases, culminating in Perl 4.036 in 1993. At that point, Wall abandoned Perl 4 to begin work on Perl 5. Initial design of Perl 5 continued into 1994. The perl5-porters mailing list was established in May 1994 to coordinate work on porting Perl 5 to different platforms. It remains the primary forum for development, maintenance, and porting of Perl 5. Perl 5.000 was released on October 17, 1994.

It was a nearly complete rewrite of the interpreter, and it added many new features to the language, including objects, references, lexical (my) variables, and modules. Importantly, modules provided a mechanism for extending the language without modifying the interpreter. This allowed the core interpreter to stabilize, even as it enabled ordinary Perl programmers to add new language features. Perl 5 has been in active development since then. Perl 5.001 was released on March 13, 1995. Perl 5.002 was released on February 29, 1996 with the new prototypes feature. This allowed module authors to make subroutines that behaved like Perl builtins. Perl 5.003 was released June 25, 1996, as a security release.

One of the most important events in Perl 5 history took place outside of the language proper and was a consequence of its module support. On October 26, 1995, the Comprehensive Perl Archive Network (CPAN) was established as a repository for Perl modules and Perl itself; as of May 2017, it carries over 185,178 modules in 35,190 distributions, written by more than 13,071 authors, and is mirrored worldwide at more than 245 locations.

Perl 5.004 was released on May 15, 1997, and included among other things the UNIVERSAL package, giving Perl a base object to which all classes were automatically derived and the ability to require versions of modules. Another significant development was the inclusion of the module, which contributed to Perl’s popularity as a CGI scripting language. Perl is also now supported running under Microsoft Windows and several other operating systems.

Perl 5.005 was released on July 22, 1998. This release included several enhancements to the regex engine, new hooks into the backend through the B::* modules, the qr// regex quote operator, a large selection of other new core modules, and added support for several more operating systems, including BeOS.

At 2000:

Perl 5.6 was released on March 22, 2000. Major changes included 64-bit support, Unicode string representation, support for files over 2 GiB, and the “our” keyword. When developing Perl 5.6, the decision was made to switch the versioning scheme to one more similar to other open source projects; after 5.005_63, the next version became 5.5.640, with plans for development versions to have odd numbers and stable versions to have even numbers.

Perl 5.8 was first released on July 18,2002, and had nearly yearly updates since then. Perl 5.8 improved Unicode support, added a new I/O implementation, added a new thread implementation, improved numeric accuracy, and added several new modules. As of 2013 this version remains the most popular version of Perl and is used by Red Hat 5, Suse 10, Solaris 10, HP-UX 11.31 and AIX 5. In 2004, work began on the “Synopses” – documents that originally summarized the Apocalypses, but which became the specification for the Perl 6 language. In February 2005, Audrey Tang began work on Pugs, a Perl 6 interpreter written in Haskell. This was the first concerted effort towards making Perl 6 a reality. This effort stalled in 2006.

On April 12, 2010, Perl 5.12.0 was released. Notable core enhancements include new package NAME VERSION syntax, the Yada Y a da operator (intended to mark placeholder code that is not yet implemented), implicit strictures, full Y2038 compliance, regex conversion overloading, D Trace support, and Unicode 5.2. On January 21, 2011, Perl 5.12.3 was released; it contains updated modules and some documentation changes. Version 5.12.4 was released on June 20, 2011. The latest version of that branch, 5.12.5, was released on November 10, 2012.

On May 14, 2011, Perl 5.14 was released. JSON support is built-in as of 5.14.0. The latest version of that branch, 5.14.4, was released on March 10, 2013. On May 20, 2012, Perl 5.16 was released. Notable new features include the ability to specify a given version of Perl that one wishes to emulate, allowing users to upgrade their version of Perl, but still run old scripts that would normally be incompatible. Perl 5.16 also updates the core to support Unicode 6.1.


PONIE is an acronym for Perl On New Internal Engine. The PONIE Project existed from 2003 until 2006 and was to be a bridge between Perl 5 and Perl 6. It was an effort to rewrite the Perl 5 interpreter to run on Parrot, the Perl 6 virtual machine. The goal was to ensure the future of the millions of lines of Perl 5 code at thousands of companies around the world. The PONIE project ended in 2006 and is no longer being actively developed. Some of the improvements made to the Perl 5 interpreter as part of PONIE were folded into that project.

PERL Features:

  • The overall structure of Perl derives broadly from C. Perl is procedural in nature, with variables, expressions, assignment statements, brace-delimited blocks, control structures, and subroutines.
  • Perl also takes features from shell programming. All variables are marked with leading sigils, which allow variables to be interpolated directly into strings. However, unlike the shell, Perl uses sigils on all accesses to variables, and unlike most other programming languages that use sigils, the sigil doesn’t denote the type of the variable but the type of the expression. So for example, to access a list of values in a hash, the sigil for an array (“@”) is used, not the sigil for a hash (“%”). Perl also has many built-in functions that provide tools often used in shell programming (although many of these tools are implemented by programs external to the shell) such as sorting, and calling operating system facilities.
  • Perl takes lists from Lisp, hashes (“associative arrays”) from AWK, and regular expressions from sed. These simplify and facilitate many parsing, text-handling, and data-management tasks. Also shared with Lisp are the implicit return of the last value in a block, and the fact that all statements have a value, and thus are also expressions and can be used in larger expressions themselves.

PERL Design:

The design of Perl can be understood as a response to three broad trends in the computer industry: falling hardware costs, rising labor costs, and improvements in compiler technology. Many earlier computer languages, such as Fortran and C, aimed to make efficient use of expensive computer hardware. In contrast, Perl was designed so that computer programmers could write programs more quickly and easily.

Perl has many features that ease the task of the programmer at the expense of greater CPU and memory requirements. These include automatic memory management; dynamic typing; strings, lists, and hashes; regular expressions; introspection; and a function. Perl follows the theory of “no built-in limits” an idea similar to the Zero One Infinity rule.

PERL Applications:

Perl has many and varied applications, compounded by the availability of many standard and third-party modules.

Perl has chiefly been used to write CGI scripts: large projects written in Perl include cPanel, Slash, Bugzilla, RT, TWiki, and Movable Type; high-traffic websites that use Perl extensively include, Craigslist, IMDb, LiveJournal, DuckDuckGo, Slashdot and Ticketmaster. It is also an optional component of the popular LAMP technology stack for Web development, in lieu of PHP or Python.

PERL Implementation:

Perl is implemented as a core interpreter, written in C, together with a large collection of modules, written in Perl and C. As of 2010, the interpreter is 150,000 lines of C code and compiles to a 1 MB executable on typical machine architectures. Alternatively, the interpreter can be compiled to a link library and embedded in other programs. There are nearly 500 modules in the distribution, comprising 200,000 lines of Perl and an additional 350,000 lines of C code (much of the C code in the modules consists of character encoding tables).

The interpreter has an object-oriented architecture. All of the elements of the Perl language—scalars, arrays, hashes, code refs, file handles—are represented in the interpreter by C structs. Operations on these structs are defined by a large collection of macros, typedefs, and functions; these constitute the Perl C API. The Perl API can be bewildering to the uninitiated, but its entry points follow a consistent naming scheme, which provides guidance to those who use it.

PERL Comparative Ranking:


perl programming language

According to Tiobe Index April 2018 perl is 16 number. According to this list java is on number one because of comparing java got 3 positions in one year.

Syntax of PERL

Interactive Mode Programming

$perl –e ‘print” Hello world”’

Scripting Mode Programming


# this will print “Hello, World”

print “Hello, world\n”;

Comments and Extension in PERL:

For comments in perl we use hash # sign to comment during coding for example:

#this is a comment in perl language

For multiline comments we use = in starting the comment and in ending the comment

In Perl we use extension .pl or .PL

Whenever we code in Perl in text editor we must use this extension because Perl compiler only compile these two extensions.

Single or Double Quotes in PERL:

During coding we can use both quotes in string for example


print “Hello, world\n”;

print ‘Hello, world\n’;

Both will be accepted by the compiler

PERL Identifiers:

Perl does not allow punctuation characters such as @, $, and % within identifiers. Perl is a case sensitive programming language. Thus $Manpower and $manpower are two different identifiers in Perl.

Data types in PERL:

Perl is a loosely typed language and there is no need to specify a type for your data while using in your program. The Perl interpreter will choose the type based on the context of the data itself.

Perl has three basic data types:

  • Scaler
  • Hashes    …. And => Arrays
  • Numeric Literals
  • Integer   1234
  • Negative integer -1234
  • Floating point 2.000
  • Scientific notation 6.12E14
  • Hexadecimal   0xff
  • Octal 0577

Array Variables:

Array variables will be initialize by @ sign in start of variables

@ages = (25, 30, 40);

Print “\$ages[0] = $ages[0]\n”;

Print “\$ages[1] = $ages[1]\n”;

Print “\$ages[2] = $ages[2]\n”;

Hash Variables:

A hash is a set of key/value pairs. Hash variables are preceded by a percent (%) sign.

%data = (‘John Paul’, 45, ‘Lisa’, 30, ‘Kumar’, 40);

Print “\$data{‘John Paul’} = $data{‘John Paul’}\n”;

Print “\$data{‘Lisa’} = $data{‘Lisa’}\n”;

Print “\$data{‘Kumar’} = $data{‘Kumar’}\n”;

Conditional operators: (if-else)

#! /usr/local/bin/perl

$name = “Ali”;

$age = 10;

$status = ($age > 60)? “A senior citizen”: “Not a senior citizen”;

Print “$name is – $status\n”;


#! /usr/local/bin/perl

For ( ;  ) {

Printf “This loop will run forever.\n”;


No comments

Leave a Reply