(redirected from Perl)

[Home]Perl programming language

HomePage | Recent Changes | Preferences

Perl (Practical Extraction and Report Language) is a programming language created by Larry Wall in 1987 that borrows features from C, sed, awk, and shell scripting (sh). Though the name originated as an acronym, it is normally spelt in normal mixed case when referring to the language, or lower case when referring to the interpreter. "Only perl properly parses Perl." Perl is free software, available for many platforms under the Artistic License and GPL.

Perl was designed to be a practical language to extract information from text files and generate reports. One of its mottos is There is more than one way to do it (TIMTOWTDI - pronounced 'Tim Toady'). Another is Perl: the Swiss Army Chainsaw of Programming Languages. Its versatility permits versions of many programming paradigms: procedural, functional, and object-oriented---though purists object to Perl's approach, which favors convenience to the programmer over clean language design. Perl is often considered the archetypal scripting language and has been called the "glue that holds the web together", as it is one of the most popular CGI languages.

Perl is available for just about every operating system but is particularly prevalent on Unix and Unix-like systems, and is growing in popularity on Microsoft Windows systems. As an example of Perl in action, Wikipedia is our own slightly customized version of CliffordAdams' UseMod Wiki software -- written in Perl, of course.

A huge collection of freely usable perl modules, ranging from advanced mathematics to database connectivity, networking and more, can be downloaded from a network of sites called CPAN.

Although Perl has most of the ease of use features of an interpreted language, it does not strictly interpret and execute the source code one line at a time. Rather, perl first compiles an entire program to an intermediate byte code (Much like Java's byte code), optimizing as it goes, and then executes that byte code. It is possible to compile a perl program to byte code to save the compilation step on later executions, though the "interpreter" is still needed to execute that code.

Perl 6 is currently being developed. It will run on a virtual machine.

Some people humorously claim Perl stands for 'Pathologically Eclectic Rubbish Lister' due to the high use of meaningful punctuation characters in the language syntax, as may be seen in this example program to print a greeting:

        # A sample Perl program
        $message = "Hello, world! The magic number is 234542354.\n";
        print $message;
        $message =~ s/\d+/-1/;
        print $message;
        exit 0

and the output:

        Hello, world! The magic number is 234542354.
        Hello, world! The magic number is -1.

The fourth line of the example shows the use of a regular expression.

In common with C, obfuscated code competitions are a major part of the Perl culture.

See also: APL, Python, Ruby

External links:


HomePage | Recent Changes | Preferences
This page is read-only | View other revisions
Last edited December 18, 2001 12:01 am by AxelBoldt (diff)