Perl
Encyclopedia
Perl is a high-level
High-level programming language
A high-level programming language is a programming language with strong abstraction from the details of the computer. In comparison to low-level programming languages, it may use natural language elements, be easier to use, or be from the specification of the program, making the process of...

, general-purpose
General-purpose programming language
In computer software a general-purpose programming language is a programming language designed to be used for writing software in a wide variety of application domains...

, interpreted
Interpreter (computing)
In computer science, an interpreter normally means a computer program that executes, i.e. performs, instructions written in a programming language...

, dynamic programming language
Dynamic programming language
Dynamic programming language is a term used broadly in computer science to describe a class of high-level programming languages that execute at runtime many common behaviors that other languages might perform during compilation, if at all...

. Perl was originally developed by Larry Wall
Larry Wall
Larry Wall is a programmer and author, most widely known for his creation of the Perl programming language in 1987.-Education:Wall earned his bachelor's degree from Seattle Pacific University in 1976....

 in 1987 as a general-purpose Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular amongst programmers. Larry Wall continues to oversee development of the core language, and its upcoming version, Perl 6
Perl 6
Perl 6 is a major revision to the Perl programming language. It is still in development, as a specification from which several interpreter and compiler implementations are being written. It is introducing elements of many modern and historical languages. Perl 6 is intended to have many...

. Perl borrows features from other programming languages including C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

, shell script
Shell script
A shell script is a script written for the shell, or command line interpreter, of an operating system. It is often considered a simple domain-specific programming language...

ing (sh
Bourne shell
The Bourne shell, or sh, was the default Unix shell of Unix Version 7 and most Unix-like systems continue to have /bin/sh - which will be the Bourne shell, or a symbolic link or hard link to a compatible shell - even when more modern shells are used by most users.Developed by Stephen Bourne at AT&T...

), AWK
AWK (programming language)
The AWK utility is a data extraction and reporting tool that uses a data-driven scripting language consisting of a set of actions to be taken against textual data for the purpose of producing formatted reports...

, and sed
Sed
sed is a Unix utility that parses text and implements a programming language which can apply transformations to such text. It reads input line by line , applying the operation which has been specified via the command line , and then outputs the line. It was developed from 1973 to 1974 as a Unix...

. The language provides powerful text processing facilities without the arbitrary data length limits of many contemporary Unix tools, facilitating easy manipulation of text file
Text file
A text file is a kind of computer file that is structured as a sequence of lines of electronic text. A text file exists within a computer file system...

s. Perl gained widespread popularity in the late 1990s as a CGI scripting
Common Gateway Interface
The Common Gateway Interface is a standard method for web servers software to delegate the generation of web pages to executable files...

 language, in part due to its parsing abilities., but is now in sharp decline for this application, where it is increasingly being replaced by more user-friendly CGI languages such as PHP
PHP
PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...

, Ruby
Ruby (programming language)
Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto...

 and Python
Python (programming language)
Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...

.

In addition to CGI, Perl is used for graphics programming, system administration
System administrator
A system administrator, IT systems administrator, systems administrator, or sysadmin is a person employed to maintain and operate a computer system and/or network...

, network programming
Computer network programming
In computing, network programming, essentially identical to socket programming or client–server programming, involves writing computer programs that communicate with other programs across a computer network. The program or process initiating the communication is called a client process, and the...

, finance, bioinformatics
Bioinformatics
Bioinformatics is the application of computer science and information technology to the field of biology and medicine. Bioinformatics deals with algorithms, databases and information systems, web technologies, artificial intelligence and soft computing, information and computation theory, software...

, and other applications. Perl is nicknamed "the Swiss Army chainsaw of programming languages" due to its flexibility and power. It is also referred to as the "duct tape that holds the Internet together", in reference to its ubiquity and perceived inelegance.

Early versions

Larry Wall
Larry Wall
Larry Wall is a programmer and author, most widely known for his creation of the Perl programming language in 1987.-Education:Wall earned his bachelor's degree from Seattle Pacific University in 1976....

 began work on Perl in 1987, while working as a programmer at Unisys
Unisys
Unisys Corporation , headquartered in Blue Bell, Pennsylvania, United States, and incorporated in Delaware, is a long established business whose core products now involves computing and networking.-History:...

, and released version 1.0 to the comp.sources.misc newsgroup
Newsgroup
A usenet newsgroup is a repository usually within the Usenet system, for messages posted from many users in different locations. The term may be confusing to some, because it is usually a discussion group. Newsgroups are technically distinct from, but functionally similar to, discussion forums on...

 on December 18, 1987. The language expanded rapidly over the next few years.

Perl 2, released in 1988, featured a better regular expression
Regular expression
In computing, a regular expression provides a concise and flexible means for "matching" strings of text, such as particular characters, words, or patterns of characters. Abbreviations for "regular expression" include "regex" and "regexp"...

 engine. Perl 3, released in 1989, added support for binary data streams.

Originally the only documentation for Perl was a single (increasingly lengthy) man page. In 1991, Programming Perl
Programming Perl
Programming Perl, ISBN 0-596-00027-8,best known as the Camel Book among programmers, is a book and ebook about writing programs using the Perl programming language, revised as several editions to reflect major language changes since Perl version 4. Editions have been co-written by the creator of...

, 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 documented by the book.

Early Perl 5

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
Mailing list
A mailing list is a collection of names and addresses used by an individual or an organization to send material to multiple recipients. The term is often extended to include the people subscribed to such a list, so the group of subscribers is referred to as "the mailing list", or simply "the...

 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
Interpreter (computing)
In computer science, an interpreter normally means a computer program that executes, i.e. performs, instructions written in a programming language...

, and it added many new features to the language, including objects, references, lexical (my) variables
Local variable
In computer science, a local variable is a variable that is given local scope. Such a variable is accessible only from the function or block in which it is declared. In programming languages with only two levels of visibility, local variables are contrasted with global 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
Shell builtin
In computing, a shell builtin is a command or a function, called from a shell, that is executed directly in the shell itself, instead of an external executable program which the shell would load and execute....

. 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
Software repository
A software repository is a storage location from which software packages may be retrieved and installed on a computer.- Discussion :Many software publishers and other organizations maintain servers on the Internet for this purpose, either free of charge or for a subscription fee...

 for Perl module
Perl module
A Perl module is a discrete component of software for the Perl programming language. Technically, it is a particular set of conventions for using Perl's package mechanism that has become universally adopted....

s and Perl itself. As of January 2011, it carries over 19,000 modules by more than 8,000 authors.

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 CGI.pm
CGI.pm
CGI.pm is a large and widely used Perl module for programming Common Gateway Interface web applications, providing a consistent API for receiving user input and producing HTML or XHTML output....

 module, which contributed to Perl's popularity as a CGI scripting language.

Perl 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
Regular expression
In computing, a regular expression provides a concise and flexible means for "matching" strings of text, such as particular characters, words, or patterns of characters. Abbreviations for "regular expression" include "regex" and "regexp"...

 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
BeOS
BeOS is an operating system for personal computers which began development by Be Inc. in 1991. It was first written to run on BeBox hardware. BeOS was optimized for digital media work and was written to take advantage of modern hardware facilities such as symmetric multiprocessing by utilizing...

.

2000–present

Perl 5.6 was released on March 22, 2000. Major changes included 64-bit support, Unicode
Unicode
Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...

 string representation, large file support (i.e. 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.

In 2000, Larry Wall put forth a call for suggestions for a new version of Perl from the community. The process resulted in 361 RFC (request for comments) documents which were to be used in guiding development of Perl 6. In 2001, work began on the apocalypses for Perl 6
Perl 6
Perl 6 is a major revision to the Perl programming language. It is still in development, as a specification from which several interpreter and compiler implementations are being written. It is introducing elements of many modern and historical languages. Perl 6 is intended to have many...

, a series of documents meant to summarize the change requests and present the design of the next generation of Perl. They were presented as a digest of the RFCs, rather than a formal document. At this point, Perl 6 existed only as a description of a language.

Perl 5.8 was first released on July 18, 2002, and had nearly yearly updates since then. The latest version of Perl 5.8 is 5.8.9, released December 14, 2008. Perl 5.8 improved unicode support, added a new IO implementation, added a new thread implementation, improved numeric accuracy, and added several new modules.

In 2004, work began on the Synopses – originally documents that summarized the Apocalypses, but which became the specification for the Perl 6 language. In February 2005, Audrey Tang
Audrey Tang
Audrey Tang is a Taiwanese free software programmer, who has been described as one of the "ten greats of Taiwanese computing."-Biography:...

 began work on Pugs
Pugs
Pugs is a compiler and interpreter for the Perl 6 programming language, started on February 1, 2005 by Audrey Tang.Pugs development is now placed on hiatus, with most Perl 6 implementation efforts now taking place on Rakudo; however, its source repository is still used for storing the official Perl...

, a Perl 6 interpreter written in Haskell
Haskell (programming language)
Haskell is a standardized, general-purpose purely functional programming language, with non-strict semantics and strong static typing. It is named after logician Haskell Curry. In Haskell, "a function is a first-class citizen" of the programming language. As a functional programming language, the...

. This was the first concerted effort towards making Perl 6 a reality. This effort stalled in 2006.

On December 18, 2007, the 20th anniversary of Perl 1.0, Perl 5.10.0 was released. Perl 5.10.0 included notable new features, which brought it closer to Perl 6
Perl 6
Perl 6 is a major revision to the Perl programming language. It is still in development, as a specification from which several interpreter and compiler implementations are being written. It is introducing elements of many modern and historical languages. Perl 6 is intended to have many...

. These included a switch statement
Switch statement
In computer programming, a switch, case, select or inspect statement is a type of selection control mechanism that exists in most imperative programming languages such as Pascal, Ada, C/C++, C#, Java, and so on. It is also included in several other types of languages...

 (called "given"/"when"), regular expressions updates, and the smart match operator, "~~".
Around this same time, development began in earnest on another implementation of Perl 6 known as Rakudo Perl
Rakudo Perl
Rakudo Perl is a compiler that implements the Perl 6 specification and runs on the Parrot virtual machine. Rakudo Perl is currently in development....

, developed in tandem with the Parrot virtual machine
Parrot virtual machine
Parrot is a register-based process virtual machine designed to run dynamic languages efficiently. It uses just-in-time compilation for speed to reduce the interpretation overhead. It is currently possible to compile Parrot assembly language and PIR to Parrot bytecode and execute it...

. As of November 2009, Rakudo Perl has had regular monthly releases and now is the most complete implementation of Perl 6
Perl 6
Perl 6 is a major revision to the Perl programming language. It is still in development, as a specification from which several interpreter and compiler implementations are being written. It is introducing elements of many modern and historical languages. Perl 6 is intended to have many...

.

A major change in the development process of Perl 5 occurred with Perl 5.11; the development community has switched to a monthly release cycle, with planned release dates three months ahead.

On April 12, 2010, Perl 5.12.0 was released. Notable core enhancements include new package NAME VERSION syntax, the Yada Yada operator (intended to mark placeholder code that is not yet implemented), implicit strictures, full Y2038 compliance, regex conversion overloading, DTrace
DTrace
DTrace is a comprehensive dynamic tracing framework created by Sun Microsystems for troubleshooting kernel and application problems on production systems in real time...

 support, and Unicode
Unicode
Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...

 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.

On May 14, 2011, Perl 5.14 was released. On September 26, 2011, the latest version, 5.14.2, was released.

The latest development release of Perl 5 is 5.15.4, released by Jesse Vincent on October 20, 2011.

Name

Perl was originally named "Pearl", after the Parable of the Pearl
Parable of the Pearl
The Parable of the Pearl is a parable of Jesus. It appears in only one of the Canonical gospels of the New Testament...

 from the Gospel of Matthew
Gospel of Matthew
The Gospel According to Matthew is one of the four canonical gospels, one of the three synoptic gospels, and the first book of the New Testament. It tells of the life, ministry, death, and resurrection of Jesus of Nazareth...

. Larry Wall wanted to give the language a short name with positive connotations; he claims that he considered (and rejected) every three- and four-letter word in the dictionary. He also considered naming it after his wife Gloria. Wall discovered the existing PEARL programming language before Perl's official release and changed the spelling of the name.

When referring to the language, the name is normally capitalized (Perl) as a proper noun. When referring to the interpreter program itself, the name is often uncapitalized (perl) because most Unix-like file systems are case-sensitive. Before the release of the first edition of Programming Perl, it was common to refer to the language as perl; Randal L. Schwartz
Randal L. Schwartz
Randal L. Schwartz , also known as merlyn, is an American author, system administrator and programming consultant.-Career:...

, however, capitalized the language's name in the book to make it stand out better when typeset. This case distinction was subsequently documented as canonical.

There is some contention about the all-caps spelling "PERL", which the documentation declares incorrect and which some core community members consider a sign of outsiders
Shibboleth
A shibboleth is a custom, principle, or belief distinguishing a particular class or group of people, especially a long-standing one regarded as outmoded or no longer important...

. The name is occasionally backronym
Backronym
A backronym or bacronym is a phrase constructed purposely, such that an acronym can be formed to a specific desired word. Backronyms may be invented with serious or humorous intent, or may be a type of false or folk etymology....

ed as Practical Extraction and Report Language, which appears at the top of the documentation and in some printed literature. Several backronyms have been suggested as equally canonical, including Wall's own humorous Pathologically Eclectic Rubbish Lister. Indeed, Wall claims that the name was intended to inspire many different expansions.

Camel symbol

Programming Perl, published by O'Reilly Media
O'Reilly Media
O'Reilly Media is an American media company established by Tim O'Reilly that publishes books and Web sites and produces conferences on computer technology topics...

, features a picture of a camel
Camel
A camel is an even-toed ungulate within the genus Camelus, bearing distinctive fatty deposits known as humps on its back. There are two species of camels: the dromedary or Arabian camel has a single hump, and the bactrian has two humps. Dromedaries are native to the dry desert areas of West Asia,...

 on the cover and is commonly referred to as the "Camel Book". This image of a camel has become an unofficial symbol of Perl as well as a general hacker emblem, appearing on T-shirts and other clothing items.

O'Reilly owns the image as a trademark but licenses it for non-commercial use, requiring only an acknowledgement and a link to www.perl.com. Licensing for commercial use is decided on a case by case basis. O'Reilly also provides "Programming Republic of Perl" logos for non-commercial sites and "Powered by Perl" buttons for any site that uses Perl.

Onion symbol

The Perl Foundation
The Perl Foundation
The Perl Foundation is dedicated to the advancement of the Perl programming language through open discussion, collaboration, design, and code...

 owns an alternative symbol, an onion, which it licenses to its subsidiaries, Perl Mongers
Perl Mongers
Perl Mongers is part of The Perl Foundation and provides services to user groups for the Perl programming language.Perl Mongers was created in 1998 as a stand-alone organization by brian d foy who formed the first Perl users group, the New York Perl Mongers, or NY.pm, in 1997 at the First O'Reilly...

, PerlMonks, Perl.org, and others. The symbol is a visual pun
Visual pun
A visual pun is a pun involving an image or images .Visual puns in which the image is at odds with the inscription are common in Dutch gable stones as well as in cartoons such as Lost Consonants or The Far Side...

 on pearl onion
Pearl onion
The "true" pearl onion is a close relative of leek , and may be distinguished from bulb onions by having only a single storage leaf, similar to cloves of garlic...

.

Overview

Perl is a general-purpose programming language originally developed for text manipulation, but is used for a wide range of tasks including system administration, web development
Web development
Web development is a broad term for the work involved in developing a web site for the Internet or an intranet . This can include web design, web content development, client liaison, client-side/server-side scripting, web server and network security configuration, and e-commerce development...

, network programming
Computer network programming
In computing, network programming, essentially identical to socket programming or client–server programming, involves writing computer programs that communicate with other programs across a computer network. The program or process initiating the communication is called a client process, and the...

, games, bioinformatics
Bioinformatics
Bioinformatics is the application of computer science and information technology to the field of biology and medicine. Bioinformatics deals with algorithms, databases and information systems, web technologies, artificial intelligence and soft computing, information and computation theory, software...

, and GUI
Gui
Gui or guee is a generic term to refer to grilled dishes in Korean cuisine. These most commonly have meat or fish as their primary ingredient, but may in some cases also comprise grilled vegetables or other vegetarian ingredients. The term derives from the verb, "gupda" in Korean, which literally...

 development.

The language is intended to be practical (easy to use, efficient, complete) rather than beautiful (tiny, elegant, minimal). Its major features include support for multiple programming paradigm
Programming paradigm
A programming paradigm is a fundamental style of computer programming. Paradigms differ in the concepts and abstractions used to represent the elements of a program and the steps that compose a computation A programming paradigm is a fundamental style of computer programming. (Compare with a...

s (procedural, object-oriented
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...

, and functional
Functional programming
In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state...

 styles), reference counting
Reference counting
In computer science, reference counting is a technique of storing the number of references, pointers, or handles to a resource such as an object, block of memory, disk space or other resource...

 memory management
Memory management
Memory management is the act of managing computer memory. The essential requirement of memory management is to provide ways to dynamically allocate portions of memory to programs at their request, and freeing it for reuse when no longer needed. This is critical to the computer system.Several...

 (without a cycle-detecting garbage collector), built-in support for text processing, and a large collection of third-party modules.

According to Larry Wall, Perl has two slogans. The first is "There's more than one way to do it", commonly known as TMTOWTDI. The second slogan is "Easy things should be easy and hard things should be possible".

Features

The overall structure of Perl derives broadly from C. Perl is procedural
Procedural programming
Procedural programming can sometimes be used as a synonym for imperative programming , but can also refer to a programming paradigm, derived from structured programming, based upon the concept of the procedure call...

 in nature, with variable
Variable (programming)
In computer programming, a variable is a symbolic name given to some known or unknown quantity or information, for the purpose of allowing the name to be used independently of the information it represents...

s, expressions
Expression (programming)
An expression in a programming language is a combination of explicit values, constants, variables, operators, and functions that are interpreted according to the particular rules of precedence and of association for a particular programming language, which computes and then produces another value...

, assignment statements, brace
Bracket
Brackets are tall punctuation marks used in matched pairs within text, to set apart or interject other text. In the United States, "bracket" usually refers specifically to the "square" or "box" type.-List of types:...

-delimited blocks, control structures, and subroutine
Subroutine
In computer science, a subroutine is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code....

s.

Perl also takes features from shell programming. All variables are marked with leading sigils
Sigil (computer programming)
In computer programming, a sigil is a symbol attached to a variable name, showing the variable's datatype or scope. In 1999 Philip Gwyn adopted the term "to mean the funny character at the front of a Perl variable".- Historical context:...

, which unambiguously identify the data type (for example, scalar, array, hash) of the variable in context. Importantly, sigils allow variables to be interpolated directly into strings. Perl 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 on system facilities.

Perl takes lists from Lisp, hashes
Associative array
In computer science, an associative array is an abstract data type composed of a collection of pairs, such that each possible key appears at most once in the collection....

 ("associative arrays") from AWK, and regular expression
Regular expression
In computing, a regular expression provides a concise and flexible means for "matching" strings of text, such as particular characters, words, or patterns of characters. Abbreviations for "regular expression" include "regex" and "regexp"...

s from sed
Sed
sed is a Unix utility that parses text and implements a programming language which can apply transformations to such text. It reads input line by line , applying the operation which has been specified via the command line , and then outputs the line. It was developed from 1973 to 1974 as a Unix...

. These simplify and facilitate many parsing, text-handling, and data-management tasks.

Perl 5 added features that support complex data structure
Data structure
In computer science, a data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks...

s, first-class function
First-class function
In computer science, a programming language is said to have first-class functions if it treats functions as first-class objects. Specifically, this means that the language supports passing functions as arguments to other functions, returning them as the values from other functions, and assigning...

s (that is, closures
Closure (computer science)
In computer science, a closure is a function together with a referencing environment for the non-local variables of that function. A closure allows a function to access variables outside its typical scope. Such a function is said to be "closed over" its free variables...

 as values), and an object-oriented programming model. These include references
Reference (computer science)
In computer science, a reference is a value that enables a program to indirectly access a particular data item, such as a variable or a record, in the computer's memory or in some other storage device. The reference is said to refer to the data item, and accessing those data is called...

, packages, class-based method dispatch, and lexically scoped variables
Scope (programming)
In computer programming, scope is an enclosing context where values and expressions are associated. Various programming languages have various types of scopes. The type of scope determines what kind of entities it can contain and how it affects them—or semantics...

, along with compiler directives (for example, the strict pragma). A major additional feature introduced with Perl 5 was the ability to package code as reusable modules. Larry Wall later stated that "The whole intent of Perl 5's module system was to encourage the growth of Perl culture rather than the Perl core."

All versions of Perl do automatic data-typing and automatic memory-management. The interpreter knows the type and storage requirements of every data object in the program; it allocates and frees storage for them as necessary using reference counting
Reference counting
In computer science, reference counting is a technique of storing the number of references, pointers, or handles to a resource such as an object, block of memory, disk space or other resource...

 (so it cannot deallocate circular data structures without manual intervention). Legal type-conversions — for example, conversions from number to string — are done automatically at run time; illegal type conversions are fatal errors.

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
Fortran
Fortran is a general-purpose, procedural, imperative programming language that is especially suited to numeric computation and scientific computing...

 and C, aimed to make efficient use of expensive computer hardware. In contrast, Perl is designed to make efficient use of expensive computer-programmers.

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 an eval function. Perl follows the theory of "no built-in limits", an idea similar to the Zero One Infinity
Zero One Infinity
The Zero one or infinity rule is a rule of thumb in software design originated by early computing pioneer Willem van der Poel. It suggests that arbitrary limits on the number of instances of a particular entity should not be allowed...

 rule.

Wall was trained as a linguist, and the design of Perl is very much informed by linguistic principles. Examples include Huffman coding
Huffman coding
In computer science and information theory, Huffman coding is an entropy encoding algorithm used for lossless data compression. The term refers to the use of a variable-length code table for encoding a source symbol where the variable-length code table has been derived in a particular way based on...

 (common constructions should be short), good end-weighting (the important information should come first), and a large collection of language primitives. Perl favors language constructs that are concise and natural for humans to write, even where they complicate the Perl interpreter.

Perl syntax reflects the idea that "things that are different should look different." For example, scalars, arrays, and hashes have different leading sigils. Array indices and hash keys use different kinds of braces. Strings and regular expressions have different standard delimiters. This approach can be contrasted with languages such as Lisp
Lisp programming language
Lisp is a family of computer programming languages with a long history and a distinctive, fully parenthesized syntax. Originally specified in 1958, Lisp is the second-oldest high-level programming language in widespread use today; only Fortran is older...

, where the same S-expression
S-expression
S-expressions or sexps are list-based data structures that represent semi-structured data. An S-expression may be a nested list of smaller S-expressions. S-expressions are probably best known for their use in the Lisp family of programming languages...

 construct and basic syntax are used for many different purposes.

Perl does not enforce any particular programming paradigm (procedural, object-oriented, functional, or others) or even require the programmer to choose among them.

There is a broad practical bent to both the Perl language and the community and culture that surround it. The preface to Programming Perl begins: "Perl is a language for getting your job done." One consequence of this is that Perl is not a tidy language. It includes many features, tolerates exceptions to its rules, and employs heuristics to resolve syntactical ambiguities. Because of the forgiving nature of the compiler, bugs can sometimes be hard to find. Perl's function documentation remarks on the variant behavior of built-in functions in list and scalar contexts that "In general, they do what you want, unless you want consistency."

No written specification or standard for the Perl language exists for Perl versions through Perl 5, and there are no plans to create one for the current version of Perl. There has been only one implementation of the interpreter, and the language has evolved along with it. That interpreter, together with its functional tests, stands as a de facto specification of the language. Perl 6
Perl 6
Perl 6 is a major revision to the Perl programming language. It is still in development, as a specification from which several interpreter and compiler implementations are being written. It is introducing elements of many modern and historical languages. Perl 6 is intended to have many...

, however, started with a specification, and several projects aim to implement some or all of the specification.

Applications

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

Ever since the early days of the Web, programmers have used Perl to write CGI
Common Gateway Interface
The Common Gateway Interface is a standard method for web servers software to delegate the generation of web pages to executable files...

 scripts. Perl is known as one of "the three Ps" (along with Python
Python (programming language)
Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...

 and PHP
PHP
PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...

), the most popular dynamic languages for writing Web applications. It is also an integral component of the popular LAMP
LAMP (software bundle)
LAMP is an acronym for a solution stack of free, open source software, referring to the first letters of Linux , Apache HTTP Server, MySQL and PHP , principal components to build a viable general purpose web server.The GNU project is advocating people to use the term "GLAMP" since what is known as...

 solution stack
Solution stack
In computing, a solution stack is a set of software subsystems or components needed to deliver a fully functional solution, e.g. a product or service....

 for web development. Large projects written in Perl include cPanel
CPanel
cPanel is a Linux based web hosting control panel that provides a graphical interface and automation tools designed to simplify the process of hosting a web site...

, Slash, Bugzilla
Bugzilla
Bugzilla is a Web-based general-purpose bugtracker and testing tool originally developed and used by the Mozilla project, and licensed under the Mozilla Public License....

, RT
Request Tracker
Request Tracker, commonly abbreviated to RT, is a ticket-tracking system written in Perl used to coordinate tasks and manage requests among a community of users. RT's first release in 1996 was written by Jesse Vincent, who later formed Best Practical Solutions LLC to distribute, develop, and...

, TWiki
TWiki
TWiki is a Perl-based structured wiki application, typically used to run a collaboration platform, knowledge or document management system, a knowledge base, or team portal...

, and Movable Type
Movable Type
Movable Type is a weblog publishing system developed by the company Six Apart. It was publicly announced on September 3, 2001; version 1.0 was publicly released on October 8, 2001. On 12 December 2007, Movable Type was relicensed as free software under the GNU General Public License...

. Many high-traffic websites use Perl extensively. Examples include Amazon.com
Amazon.com
Amazon.com, Inc. is a multinational electronic commerce company headquartered in Seattle, Washington, United States. It is the world's largest online retailer. Amazon has separate websites for the following countries: United States, Canada, United Kingdom, Germany, France, Italy, Spain, Japan, and...

, bbc.co.uk
Bbc.co.uk
BBC Online is the brand name and home for the BBC's UK online service. It is a large network of websites including such high profile sites as BBC News and Sport, the on-demand video and radio services co-branded BBC iPlayer, the pre-school site Cbeebies, and learning services such as Bitesize...

, Priceline.com
Priceline.com
Priceline.com is a company and a commercial website that helps users obtain discount rates for travel-related purchases such as airline tickets and hotel stays. The company is not a direct supplier of these services; instead it facilitates the provision of travel services by its suppliers to its...

, Craigslist
Craigslist
Craigslist is a centralized network of online communities featuring free online classified advertisements, with sections devoted to jobs, housing, personals, for sale, services, community, gigs, résumés, and discussion forums....

, IMDb
Internet Movie Database
Internet Movie Database is an online database of information related to movies, television shows, actors, production crew personnel, video games and fictional characters featured in visual entertainment media. It is one of the most popular online entertainment destinations, with over 100 million...

, LiveJournal
LiveJournal
LiveJournal is a virtual community where Internet users can keep a blog, journal or diary. LiveJournal is also the name of the free and open source server software that was designed to run the LiveJournal virtual community....

, Slashdot
Slashdot
Slashdot is a technology-related news website owned by Geeknet, Inc. The site, which bills itself as "News for Nerds. Stuff that Matters", features user-submitted and ‑evaluated current affairs news stories about science- and technology-related topics. Each story has a comments section...

 and Ticketmaster
Ticketmaster
Ticketmaster Entertainment, Inc. is an independent American ticket sales and distribution company based in West Hollywood, California, USA, with operations in many countries around the world. In 2010 it merged with Live Nation to become Live Nation Entertainment...

.

Perl is often used as a glue language
Glue language
A glue language is a programming language used for connecting software components together.Examples of glue languages:* Unix Shell scripts * Windows NT type Shell scripts...

, tying together systems and interfaces that were not specifically designed to interoperate, and for "data munging", that is, converting or processing large amounts of data for tasks such as creating reports. In fact, these strengths are intimately linked. The combination makes Perl a popular all-purpose language for system administrator
System administrator
A system administrator, IT systems administrator, systems administrator, or sysadmin is a person employed to maintain and operate a computer system and/or network...

s, particularly because short programs can be entered and run on a single command line.

With a degree of care, Perl code can be made portable across Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

 and Unix. Portable Perl code is often used by suppliers of software (both COTS
Commercial off-the-shelf
In the United States, Commercially available Off-The-Shelf is a Federal Acquisition Regulation term defining a nondevelopmental item of supply that is both commercial and sold in substantial quantities in the commercial marketplace, and that can be procured or utilized under government contract...

 and bespoke) to simplify packaging and maintenance of software build- and deployment-scripts.

Graphical user interfaces (GUIs) may be developed using Perl. For example, Perl/Tk is commonly used to enable user interaction with Perl scripts. Such interaction may be synchronous or asynchronous, using callbacks to update the GUI. For more information about the technologies involved, see Tk, Tcl
Tcl
Tcl is a scripting language created by John Ousterhout. Originally "born out of frustration", according to the author, with programmers devising their own languages intended to be embedded into applications, Tcl gained acceptance on its own...

 and WxPerl
WxPerl
wxPerl is a perl module by Mattia Barbon, allowing the creation of graphical user interface from Perl programming language. It is built as an XS-wrapper for the WxWidgets . Like perl and wxWidgets, wxPerl is free software....

.

Perl is also widely used in finance and in bioinformatics
Bioinformatics
Bioinformatics is the application of computer science and information technology to the field of biology and medicine. Bioinformatics deals with algorithms, databases and information systems, web technologies, artificial intelligence and soft computing, information and computation theory, software...

, where it is valued for rapid application development and deployment and for its capability to handle large data-sets.

Implementation

Perl is implemented as a core interpreter, written in C, together with a large collection of modules, written in Perl and C. , the stable version (5.12.3) is 14.2 MB
Megabyte
The megabyte is a multiple of the unit byte for digital information storage or transmission with two different values depending on context: bytes generally for computer memory; and one million bytes generally for computer storage. The IEEE Standards Board has decided that "Mega will mean 1 000...

 when packaged in a tar file
Tar (file format)
In computing, tar is both a file format and the name of a program used to handle such files...

 and gzip
Gzip
Gzip is any of several software applications used for file compression and decompression. The term usually refers to the GNU Project's implementation, "gzip" standing for GNU zip. It is based on the DEFLATE algorithm, which is a combination of Lempel-Ziv and Huffman coding...

 compressed. 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, coderefs, filehandles—are represented in the interpreter by C structs
Struct (C programming language)
A struct in C programming language is a structured type that aggregates a fixed set of labelled objects, possibly of different types, into a single object.A struct declaration consists of a list of fields, each of which can have any type...

. 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.

The life of a Perl interpreter divides broadly into a compile phase and a run phase. In Perl, the phases are the major stages in the interpreter's life-cycle. Each interpreter goes through each phase only once, and the phases follow in a fixed sequence.

Most of what happens in Perl's compile phase is compilation, and most of what happens in Perl's run phase is execution, but there are significant exceptions. Perl makes important use of its capability to execute Perl code during the compile phase. Perl will also delay compilation into the run phase. The terms that indicate the kind of processing that is actually occurring at any moment are compile time and run time. Perl is in compile time at most points during the compile phase, but compile time may also be entered during the run phase. The compile time for code in a string argument passed to the eval
Eval
In some programming languages, eval is a function which evaluates a string as though it were an expression and returns a result; in others, it executes multiple lines of code as though they had been included instead of the line including the eval...

built-in occurs during the run phase. Perl is often in run time during the compile phase and spends most of the run phase in run time. Code in BEGIN blocks executes at run time but in the compile phase.

At compile time, the interpreter parses Perl code into a syntax tree
Abstract syntax tree
In computer science, an abstract syntax tree , or just syntax tree, is a tree representation of the abstract syntactic structure of source code written in a programming language. Each node of the tree denotes a construct occurring in the source code. The syntax is 'abstract' in the sense that it...

. At run time, it executes the program by walking the tree
Tree traversal
In computer science, tree-traversal refers to the process of visiting each node in a tree data structure, exactly once, in a systematic way. Such traversals are classified by the order in which the nodes are visited...

. Text is parsed only once, and the syntax tree is subject to optimization before it is executed, so that execution is relatively efficient. Compile-time optimizations on the syntax tree include constant folding
Constant folding
Constant folding and constant propagation are related compiler optimizations used by many modern compilers. An advanced form of constant propagation known as sparse conditional constant propagation can more accurately propagate constants and simultaneously remove dead code.- Constant folding...

 and context propagation, but peephole optimization
Peephole optimization
In compiler theory, peephole optimization is a kind of optimization performed over a very small set of instructions in a segment of generated code. The set is called a "peephole" or a "window"...

 is also performed.

Perl has a Turing-complete grammar
Formal grammar
A formal grammar is a set of formation rules for strings in a formal language. The rules describe how to form strings from the language's alphabet that are valid according to the language's syntax...

 because parsing can be affected by run-time code executed during the compile phase. Therefore, Perl cannot be parsed by a straight Lex
Lex programming tool
Lex is a computer program that generates lexical analyzers . Lex is commonly used with the yacc parser generator. Lex, originally written by Mike Lesk and Eric Schmidt, is the standard lexical analyzer generator on many Unix systems, and a tool exhibiting its behavior is specified as part of the...

/Yacc
Yacc
The computer program yacc is a parser generator developed by Stephen C. Johnson at AT&T for the Unix operating system. The name is an acronym for "Yet Another Compiler Compiler." It generates a parser based on an analytic grammar written in a notation similar to BNF.Yacc used to be available as...

 lexer
Lexical analysis
In computer science, lexical analysis is the process of converting a sequence of characters into a sequence of tokens. A program or function which performs lexical analysis is called a lexical analyzer, lexer or scanner...

/parser combination. Instead, the interpreter implements its own lexer, which coordinates with a modified GNU bison
GNU bison
GNU bison, commonly known as Bison, is a parser generator that is part of the GNU Project. Bison reads a specification of a context-free language, warns about any parsing ambiguities, and generates a parser which reads sequences of tokens and decides whether the sequence conforms to the syntax...

 parser to resolve ambiguities in the language.

It is often said that "Only perl can parse Perl", meaning that only the Perl interpreter (perl) can parse the Perl language (Perl), but even this is not, in general, true. Because the Perl interpreter can simulate a Turing machine during its compile phase, it would need to decide the Halting Problem
Halting problem
In computability theory, the halting problem can be stated as follows: Given a description of a computer program, decide whether the program finishes running or continues to run forever...

 in order to complete parsing in every case. It's a long-standing result that the Halting Problem is undecidable, and therefore not even perl can always parse Perl. Perl makes the unusual choice of giving the user access to its full programming power in its own compile phase. The cost in terms of theoretical purity is high, but practical inconvenience seems to be rare.

Other programs that undertake to parse Perl, such as source-code analyzers and auto-indenters, have to contend not only with ambiguous syntactic constructs but also with the undecidability of Perl parsing in the general case. Adam Kennedy's PPI project focused on parsing Perl code as a document (retaining its integrity as a document), instead of parsing Perl as executable code (which not even Perl itself can always do). It was Kennedy who first conjectured that "parsing Perl suffers from the 'Halting Problem
Halting problem
In computability theory, the halting problem can be stated as follows: Given a description of a computer program, decide whether the program finishes running or continues to run forever...

'", which was later proved.

Perl is distributed with some 120,000 functional tests. These run as part of the normal build process and extensively exercise the interpreter and its core modules. Perl developers rely on the functional tests to ensure that changes to the interpreter do not introduce bugs; additionally, Perl users who see that the interpreter passes its functional tests on their system can have a high degree of confidence that it is working properly.

Maintenance of the Perl interpreter has become increasingly difficult over the years. The code base has undergone continuous development since 1994. The code has been optimized for performance at the expense of simplicity, clarity, and strong internal interfaces. New features have been added, yet virtually complete backward compatibility with earlier versions is maintained. Major releases of Perl were coordinated by Perl pumpkings, which handled integrating patch submissions and bug fixes, but the language has since changed to a rotating, monthly release cycle. Development discussion takes place via the perl5_porters mailing list. As of Perl 5.11, development efforts have included refactoring certain core modules known as 'dual lifed' modules out of the Perl core to help alleviate some of these problems.

Availability

Perl is dual licensed under both the Artistic License
Artistic License
The Artistic License refers most commonly to the original Artistic License , a software license used for certain free and open source software packages, most notably the standard Perl implementation and most CPAN modules, which are dual-licensed under the Artistic License and the GNU General Public...

 and the GNU General Public License
GNU General Public License
The GNU General Public License is the most widely used free software license, originally written by Richard Stallman for the GNU Project....

. Distributions are available for most operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

s. It is particularly prevalent on Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 and Unix-like
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....

 systems, but it has been ported to most modern (and many obsolete) platforms. With only six reported exceptions, Perl can be compiled from source code
Source code
In computer science, source code is text written using the format and syntax of the programming language that it is being written in. Such a language is specially designed to facilitate the work of computer programmers, who specify the actions to be performed by a computer mostly by writing source...

 on all POSIX
POSIX
POSIX , an acronym for "Portable Operating System Interface", is a family of standards specified by the IEEE for maintaining compatibility between operating systems...

-compliant, or otherwise-Unix-compatible platforms.

Because of unusual changes required for the Mac OS Classic
Mac OS history
On January 24, 1984, Apple Computer Inc. introduced the Macintosh personal computer, with the Macintosh 128K model, which came bundled with what was later renamed the Mac OS, but then known simply as the System Software....

 environment, a special port called MacPerl was shipped independently.

The Comprehensive Perl Archive Network
CPAN
CPAN, the Comprehensive Perl Archive Network, is an archive of nearly 100,000 modules of software written in Perl, as well as documentation for it. It has a presence on the World Wide Web at and is mirrored worldwide at more than 200 locations...

 carries a complete list of supported platforms with links to the distributions available on each. CPAN is also the source for publicly available Perl modules that are not part of the core Perl distribution.

Windows

Users of Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

 typically install one of the native binary distributions of Perl for Win32, most commonly Strawberry Perl
Strawberry Perl
Strawberry Perl is a distribution of the Perl programming language for the Microsoft Windows platform. While most other distributions rely on the user having software development tools already set up to install certain Perl components, Strawberry Perl ships with the most commonly used tools...

 or ActivePerl. Compiling Perl from source code
Source code
In computer science, source code is text written using the format and syntax of the programming language that it is being written in. Such a language is specially designed to facilitate the work of computer programmers, who specify the actions to be performed by a computer mostly by writing source...

 under Windows is possible, but most installations lack the requisite C compiler and build tools. This also makes it difficult to install modules from the CPAN, particularly those that are partially written in C.

ActivePerl is a closed source distribution from ActiveState
ActiveState
ActiveState is a Canadian software company headquartered in Vancouver, British Columbia. It develops, sells, and supports cross-platform development tools for dynamic languages such as Perl, PHP, Python, Ruby, and Tcl, as well as language distributions and enterprise services...

 that has regular releases that track the core Perl releases. The distribution also includes the Perl package manager
Perl package manager
Perl Package Manager is a Perl utility intended to simplify the tasks of locating, installing, upgrading and removing software packages...

 (PPM), a popular tool for installing, removing, upgrading, and managing the use of common Perl modules.

Strawberry Perl
Strawberry Perl
Strawberry Perl is a distribution of the Perl programming language for the Microsoft Windows platform. While most other distributions rely on the user having software development tools already set up to install certain Perl components, Strawberry Perl ships with the most commonly used tools...

 is an open source distribution for Windows. It has had regular, quarterly releases since January 2008, including new modules as feedback and requests come in. Strawberry Perl aims to be able to install modules like standard Perl distributions on other platforms, including compiling XS modules.

The Cygwin
Cygwin
Cygwin is a Unix-like environment and command-line interface for Microsoft Windows. Cygwin provides native integration of Windows-based applications, data, and other system resources with applications, software tools, and data of the Unix-like environment...

 emulation layer is another way of running Perl under Windows. Cygwin provides a Unix-like environment on Windows, and both Perl and CPAN are available as standard pre-compiled packages in the Cygwin setup program. Because Cygwin also includes the gcc
GNU Compiler Collection
The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...

, compiling Perl from source is also possible.

Database interfaces

Perl is widely favored for database applications. Its text-handling facilities are useful for generating SQL
SQL
SQL is a programming language designed for managing data in relational database management systems ....

 queries; arrays, hashes, and automatic memory management make it easy to collect and process the returned data.

In early versions of Perl, database interfaces were created by relinking the interpreter with a client-side database library. This was sufficiently difficult that it was done for only a few of the most-important and most widely used databases, and it restricted the resulting perl executable to using just one database interface at a time.

In Perl 5, database interfaces are implemented by Perl DBI
Perl DBI
In computing, the Perl DBI offers a standardized way for programmers using the Perl programming language to embed database communication within their programs. The latest DBI module for Perl from CPAN can run on a range of operating systems....

 modules. The DBI (Database Interface) module presents a single, database-independent interface to Perl applications, while the DBD (Database Driver) modules handle the details of accessing some 50 different databases; there are DBD drivers for most ANSI
American National Standards Institute
The American National Standards Institute is a private non-profit organization that oversees the development of voluntary consensus standards for products, services, processes, systems, and personnel in the United States. The organization also coordinates U.S. standards with international...

 SQL
SQL
SQL is a programming language designed for managing data in relational database management systems ....

 databases.

DBI provides caching for database handles and queries, which can greatly improve performance in long-lived execution environments such as mod perl
Mod perl
mod_perl is an optional module for the Apache HTTP server. It embeds a Perl interpreter into the Apache server, so that dynamic content produced by Perl scripts can be served in response to incoming requests, without the significant overhead of re-launching the Perl interpreter for each request...

, helping high-volume systems avert load spikes as in the Slashdot effect
Slashdot effect
The Slashdot effect, also known as slashdotting, occurs when a popular website links to a smaller site, causing a massive increase in traffic. This overloads the smaller site, causing it to slow down or even temporarily close. The name stems from the huge influx of web traffic that results from...

.

In modern Perl applications, especially those written using Web application framework
Web application framework
A web application framework is a software framework that is designed to support the development of dynamic websites, web applications and web services. The framework aims to alleviate the overhead associated with common activities performed in Web development...

s such as Catalyst
Catalyst (software)
Catalyst is an open source web application framework written in Perl, that closely follows the model–view–controller architecture, and supports a number of experimental web patterns. It is written using Moose, a modern object system for Perl...

, the DBI module is often used indirectly via object-relational mappers such as DBIx::Class
DBIx::Class
DBIx::Class is an object-relational mapper for Perl. It is used to map relational database table rows to Perl objects and generates SQL queries transparently to the application developer. It is popular in Web application frameworks such as Catalyst.-See also:* DBI* Other object-relational mappers...

, Class::DBI or Rose::DB::Object which generate SQL queries and handle data transparently to the application author.

Comparative performance

The Computer Language Benchmarks Game, a project hosted by Alioth
Alioth (Debian)
Alioth is a FusionForge system run by the Debian project for development of free software and free documentation,especially software or documentation to do with Debian....

, compares the performance of implementations of typical programming problems in several programming languages. The submitted Perl implementations typically perform toward the high end of the memory-usage spectrum and give varied speed results. Perl's performance in the benchmarks game is typical for interpreted languages.

Large Perl programs start more slowly than similar programs in compiled languages because perl has to compile the source every time it runs. In a talk at the YAPC::Europe 2005 conference and subsequent article "A Timely Start", Jean-Louis Leroy found that his Perl programs took much longer to run than he expected because the perl interpreter spent much of the time finding modules because of his over-large include path. Unlike Java, Python, and Ruby, Perl has only experimental support for pre-compiling. Therefore Perl programs pay this overhead penalty on every execution. The run phase of typical programs is long enough that amortized startup time is not substantial, but benchmarks that measure very short execution times are likely to be skewed due to this overhead.

A number of tools have been introduced to improve this situation. The first such tool was Apache's mod perl
Mod perl
mod_perl is an optional module for the Apache HTTP server. It embeds a Perl interpreter into the Apache server, so that dynamic content produced by Perl scripts can be served in response to incoming requests, without the significant overhead of re-launching the Perl interpreter for each request...

, which sought to address one of the most-common reasons that small Perl programs were invoked rapidly: CGI
Common Gateway Interface
The Common Gateway Interface is a standard method for web servers software to delegate the generation of web pages to executable files...

 Web
World Wide Web
The World Wide Web is a system of interlinked hypertext documents accessed via the Internet...

 development. ActivePerl
ActiveState
ActiveState is a Canadian software company headquartered in Vancouver, British Columbia. It develops, sells, and supports cross-platform development tools for dynamic languages such as Perl, PHP, Python, Ruby, and Tcl, as well as language distributions and enterprise services...

, via Microsoft ISAPI
ISAPI
The Internet Server Application Programming Interface is an N-tier API of Internet Information Services , Microsoft's collection of Windows-based web server services...

, provides similar performance improvements.

Once Perl code is compiled, there is additional overhead during the execution phase that typically isn't present for programs written in compiled languages such as C or C++. Examples of such overhead include bytecode
Bytecode
Bytecode, also known as p-code , is a term which has been used to denote various forms of instruction sets designed for efficient execution by a software interpreter as well as being suitable for further compilation into machine code...

 interpretation, reference-counting memory management, and dynamic type-checking.

Optimizing

Like any code, Perl programs can be tuned for performance
Optimization (computer science)
In computer science, program optimization or software optimization is the process of modifying a software system to make some aspect of it work more efficiently or use fewer resources...

 using benchmarks
Benchmark (computing)
In computing, a benchmark is the act of running a computer program, a set of programs, or other operations, in order to assess the relative performance of an object, normally by running a number of standard tests and trials against it...

 and profiles
Performance analysis
In software engineering, profiling is a form of dynamic program analysis that measures, for example, the usage of memory, the usage of particular instructions, or frequency and duration of function calls...

 after a readable and correct implementation is finished. In part because of Perl's interpreted nature, writing more-efficient Perl will not always be enough to meet one's performance goals for a program.

In such situations, the most-critical routines of a Perl program can be written in other languages such as C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

 or Assembler
Assembly language
An assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other programmable devices. It implements a symbolic representation of the machine codes and other constants needed to program a given CPU architecture...

, which can be connected to Perl via simple Inline modules or the more-complex-but-flexible XS
XS (Perl)
XS is an interface through which a Perl program can call a C or C++ language subroutine. The letters stand for eXternal Subroutine, or xsub, where external means external to Perl, i.e...

 mechanism. Nicholas Clark, a Perl core developer, discusses some Perl design trade-offs and solutions in a 2002 document called "When perl is not quite fast enough".

Future

At the 2000 Perl Conference
O'Reilly Open Source Convention
The O'Reilly Open Source Convention is an annual convention for the discussion of free and open source software. It is organized by the publisher O'Reilly Media and is held each summer in the United States.-Notable events:...

, Jon Orwant made a case for a major new language initiative. This led to a decision to begin work on a redesign of the language, to be called Perl 6. Proposals for new language features were solicited from the Perl community at large, and more than 300 RFCs
Request for Comments
In computer network engineering, a Request for Comments is a memorandum published by the Internet Engineering Task Force describing methods, behaviors, research, or innovations applicable to the working of the Internet and Internet-connected systems.Through the Internet Society, engineers and...

 were submitted.

Larry Wall
Larry Wall
Larry Wall is a programmer and author, most widely known for his creation of the Perl programming language in 1987.-Education:Wall earned his bachelor's degree from Seattle Pacific University in 1976....

 spent the next few years digesting the RFCs and synthesizing them into a coherent framework for Perl 6. He has presented his design for Perl 6 in a series of documents called "apocalypses", which are numbered to correspond to chapters in Programming Perl. , the developing specification of Perl 6 is encapsulated in design documents called Synopses, which are numbered to correspond to Apocalypses.

Perl 6 is not intended to be backward compatible, although there will be a compatibility mode. Perl 6 and Perl 5 are distinct languages with a common ancestry.

Thesis work by Bradley M. Kuhn
Bradley M. Kuhn
Bradley M. Kuhn is a free software activist from the United States.Kuhn is currently Executive Director of the Software Freedom Conservancy. Until 2010 he was the FLOSS Community Liaison and Technology Director of the Software Freedom Law Center . He previously served as the Executive Director of...

, overseen by Larry Wall, considered the possible use of the Java virtual machine
Java Virtual Machine
A Java virtual machine is a virtual machine capable of executing Java bytecode. It is the code execution component of the Java software platform. Sun Microsystems stated that there are over 4.5 billion JVM-enabled devices.-Overview:...

 as a runtime for Perl. Kuhn's thesis showed this approach to be problematic. In 2001, it was decided that Perl 6 would run on a cross-language virtual machine
Virtual machine
A virtual machine is a "completely isolated guest operating system installation within a normal host operating system". Modern virtual machines are implemented with either software emulation or hardware virtualization or both together.-VM Definitions:A virtual machine is a software...

 called Parrot
Parrot virtual machine
Parrot is a register-based process virtual machine designed to run dynamic languages efficiently. It uses just-in-time compilation for speed to reduce the interpretation overhead. It is currently possible to compile Parrot assembly language and PIR to Parrot bytecode and execute it...

. This will mean that other languages targeting the Parrot will gain native access to CPAN
CPAN
CPAN, the Comprehensive Perl Archive Network, is an archive of nearly 100,000 modules of software written in Perl, as well as documentation for it. It has a presence on the World Wide Web at and is mirrored worldwide at more than 200 locations...

, allowing some level of cross-language development.

In 2005, Audrey Tang
Audrey Tang
Audrey Tang is a Taiwanese free software programmer, who has been described as one of the "ten greats of Taiwanese computing."-Biography:...

 created the pugs
Pugs
Pugs is a compiler and interpreter for the Perl 6 programming language, started on February 1, 2005 by Audrey Tang.Pugs development is now placed on hiatus, with most Perl 6 implementation efforts now taking place on Rakudo; however, its source repository is still used for storing the official Perl...

 project, an implementation of Perl 6 in Haskell
Haskell (programming language)
Haskell is a standardized, general-purpose purely functional programming language, with non-strict semantics and strong static typing. It is named after logician Haskell Curry. In Haskell, "a function is a first-class citizen" of the programming language. As a functional programming language, the...

. This was, and continues to act as, a test platform for the Perl 6 language (separate from the development of the actual implementation) allowing the language designers to explore. The pugs project spawned an active Perl/Haskell cross-language community centered around the freenode
Freenode
freenode, formerly known as Open Projects Network, is an IRC network used to discuss peer-directed projects. Their servers are all accessible from the domain name [irc://chat.freenode.net chat.freenode.net], which load balances connections by using the actual servers in rotation...

 #perl6 IRC channel.

A number of features in the Perl 6 language now show similarities to Haskell.

As of early 2009, Perl 6 development is primarily centered around Rakudo Perl 6, an implementation running on top of the Parrot virtual machine. Another implementation, Mildew, is also under active development and does not use Parrot.

Development of Perl 5 is also continuing. Perl 5.12.0 was released in April 2010 with some new features influenced by the design of Perl 6. New maintenance versions are scheduled to be released on a monthly basis, the latest in the 5.12-series, 5.12.4, was released on June 20, 2011. Perl 5.14.1 was released on June 17, 2011

Perl community

Perl's culture and community has developed alongside the language itself. Usenet
Usenet
Usenet is a worldwide distributed Internet discussion system. It developed from the general purpose UUCP architecture of the same name.Duke University graduate students Tom Truscott and Jim Ellis conceived the idea in 1979 and it was established in 1980...

 was the first public venue in which Perl was introduced, but over the course of its evolution, Perl's community was shaped by the growth of broadening Internet-based services including the introduction of the World Wide Web. The community that surrounds Perl was, in fact, the topic of Larry Wall's first "State of the Onion" talk.

State of the Onion

State of the Onion is the name for Larry Wall’s yearly keynote
Keynote
A keynote in literature, music, or public speaking establishes the principal underlying theme. In corporate or commercial settings, greater importance is attached to the delivery of a keynote speech or keynote address...

-style summaries on the progress of Perl and its community. They are characterized by his hallmark humor, employing references to Perl’s culture, the wider hacker culture, Wall’s linguistic background, sometimes his family life, and occasionally even his Christian
Christian
A Christian is a person who adheres to Christianity, an Abrahamic, monotheistic religion based on the life and teachings of Jesus of Nazareth as recorded in the Canonical gospels and the letters of the New Testament...

 background.

Each talk is first given at various Perl conferences and is eventually also published online.

Perl pastimes

JAPHs
In email, Usenet, and message board postings, "Just another Perl hacker
Just another Perl hacker
Just another Perl hacker, or JAPH, typically refers to a Perl program which prints "Just another Perl hacker," . Short JAPH programs are often used as signatures in online forums, or as T-shirt designs...

" (JAPH) programs are a common trend, originated by Randal L. Schwartz
Randal L. Schwartz
Randal L. Schwartz , also known as merlyn, is an American author, system administrator and programming consultant.-Career:...

, one of the earliest professional Perl trainers. In the parlance of Perl culture, Perl programmers are known as Perl hackers, and from this derives the practice of writing short programs to print out the phrase "Just another Perl hacker
Just another Perl hacker
Just another Perl hacker, or JAPH, typically refers to a Perl program which prints "Just another Perl hacker," . Short JAPH programs are often used as signatures in online forums, or as T-shirt designs...

,". In the spirit of the original concept, these programs are moderately obfuscated and short enough to fit into the signature of an email or Usenet message. The "canonical" JAPH as developed by Schwartz includes the comma at the end, although this is often omitted.

Perl golf
Perl "golf" is the pastime of reducing the number of characters (key "strokes") used in a Perl program to the bare minimum, much as how golf
Golf
Golf is a precision club and ball sport, in which competing players use many types of clubs to hit balls into a series of holes on a golf course using the fewest number of strokes....

 players seek to take as few shots as possible in a round. The phrase's first use emphasized the difference between pedestrian code meant to teach a newcomer and terse hacks likely to amuse experienced Perl programmers, an example of the latter being JAPHs that were already used in signatures in Usenet postings and elsewhere. Similar stunts had been an unnamed pastime in the language APL in previous decades. The use of Perl to write a program that performed RSA encryption prompted a widespread and practical interest in this pastime. In subsequent years, the term "code golf
Code golf
Code golf is a type of computer programming competition in which participants strive to achieve the shortest possible code that implements a certain algorithm...

" has been applied to the pastime in other languages. A Perl Golf Apocalypse
Perl Golf Apocalypse
Perl Golf Apocalypse is a Perl coding competition with the objective of solving a basic programming task with the smallest perl code possible. The competition has its roots in the newsgroup comp.lang.perl.misc which had threads where each poster tried to solve a basic problem with shorter code...

 was held at Perl Conference 4.0 in Monterey, California in July 2000.

Obfuscation
As with C, obfuscated code
Obfuscated code
Obfuscated code is source or machine code that has been made difficult to understand for humans. Programmers may deliberately obfuscate code to conceal its purpose or its logic to prevent tampering, deter reverse engineering, or as a puzzle or recreational challenge for someone reading the source...

 competitions were a well known pastime in the late 1990s. The Obfuscated Perl Contest
Obfuscated Perl contest
The Obfuscated Perl Contest was a competition for programmers of Perl which was held annually between 1996 and 2000. Entrants to the competition aimed to write "devious, inhuman, disgusting, amusing, amazing, and bizarre Perl code"...

 was a competition held by The Perl Journal from 1996 to 2000 that made an arch virtue of Perl's syntactic flexibility. Awards were given for categories such as "most powerful"—programs that made efficient use of space—and "best four-line signature" for programs that fit into four lines of 76 characters in the style of a Usenet signature block
Signature block
A signature block is a block of text automatically appended at the bottom of an e-mail message, Usenet article, or forum post. This has the effect of "signing off" the message and in a reply message of indicating that no more response follows...

.

Poetry
Perl poetry is the practice of writing poems that can be compiled as legal Perl code, for example the piece known as Black Perl
Black Perl
Black Perl is a famous piece of Perl poetry. It was posted to Usenet on April 1, 1990. It is written in Perl 3 and will not parse under Perl 5. Multiple independent updates to make it parsable in Perl 5 have been published...

. This hobby is made possible by the large number of English words that are used in the Perl. New poems are regularly submitted to the community at PerlMonks.

Perl on IRC

There are a number of IRC
Internet Relay Chat
Internet Relay Chat is a protocol for real-time Internet text messaging or synchronous conferencing. It is mainly designed for group communication in discussion forums, called channels, but also allows one-to-one communication via private message as well as chat and data transfer, including file...

 channels that offer support for the language and some modules.
IRC Network Channels
irc.freenode.net #perl #perl6 #cbstream #perlcafe #poe
irc.perl.org #moose #poe #catalyst #dbix-class #perl-help #distzilla #epo #corehackers #sdl #win32 #toolchain #padre
irc.slashnet.org #perlmonks
irc.oftc.net #perl
irc.efnet.net #perlhelp
irc.rizon.net #perl
irc.debian.org #debian-perl

CPAN Acme

There are also many examples of code written purely for entertainment on the CPAN
CPAN
CPAN, the Comprehensive Perl Archive Network, is an archive of nearly 100,000 modules of software written in Perl, as well as documentation for it. It has a presence on the World Wide Web at and is mirrored worldwide at more than 200 locations...

. Lingua::Romana::Perligata, for example, allows writing programs in Latin
Latin
Latin is an Italic language originally spoken in Latium and Ancient Rome. It, along with most European languages, is a descendant of the ancient Proto-Indo-European language. Although it is considered a dead language, a number of scholars and members of the Christian clergy speak it fluently, and...

. Upon execution of such a program, the module translates its source code into regular Perl and runs it.

The Perl community has set aside the "Acme
Acme Corporation
The Acme Corporation is a fictional corporation that features prominently in the Road Runner/Wile E. Coyote cartoons as a running gag featuring outlandish products that fail catastrophically at the worst possible times...

" namespace for modules that are fun in nature (but its scope has widened to include exploratory or experimental code or any other module that is not meant to ever be used in production). Some of the Acme modules are deliberately implemented in amusing ways. This includes Acme::Bleach, one of the first modules in the Acme:: namespace, which allows the program's source code to be "whitened" (i.e., all characters replaced with whitespace) and yet still work.

See also

  • Perl language structure
    Perl language structure
    The structure of the Perl programming language encompasses both the syntactical rules of the language and the general ways in which programs are organized. Perl's design philosophy is expressed in the commonly cited motto "there's more than one way to do it". As a multi-paradigm, dynamically typed...

  • Perl Data Language
    Perl Data Language
    PDL is a set of array programming extensions to the Perl programming language.PDL is an extension to Perl v5, intended for scientific and other data intensive programming tasks...

  • Perl Object Environment
    Perl Object Environment
    The Perl Object Environment or POE is a library of Perl modules written in the Perl programming language by Rocco Caputo et al.From CPAN:-POE Architecture: Layers of Abstraction :...

  • Plain Old Documentation
    Plain Old Documentation
    Plain Old Documentation, abbreviated pod, is a lightweight markup language used to document the Perl programming language.-Design:pod is designed to be a simple, clean language with just enough syntax to be useful. It purposefully does not include mechanisms for fonts, images, colors or tables...


Further reading

  • Perl Cookbook
    Perl Cookbook
    The Perl Cookbook, ISBN 0-596-00313-7, is a book containing solutions to common short tasks in Perl. Each chapter covers a particular topic area and is divided into around a dozen recipes each on a particular problem...

    , ISBN 0-596-00313-7
  • The Perl Journal published 1996–2006 was the leading publication for and about Perl Programming during this time.

External links

Perl.org
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK