Perl Language

Created by Larry Wall in 1987, Perl was initially an efficient interpreted language optimized for processing text files. Nowadays it is a complete language, not only a Scripting Language.

My first impression of Perl - which lasted over several years using it - is Larry Wall must be a very fast, accurate, typist. --Phl Ip

Perl is not an acronym, apocryphal folklore and post-facto expansions notwithstanding. It has various Backro Nyms, including "Practical Extraction and Report Language" or "Pathologically Eclectic Rubbish Lister". However, Larry Wall has said that you can expand "Perl" either way if you are so inclined, even though "Perl" is not an acronym.


Replace excessively complex shell/awk/sed scripts in Unix.

Web applications (a la Wiki, in Hyper Perl).

System administration scripting.

Data Mining

Data Format Conversion

"Middle-tier" ware. (Socket-based servers that also talk to databases.)

See Also:

Python Vs Perl -- a comparison to Python (which may or may not be better language ({perl, python} pwns all!)

External Web Sites: -- The Perl Directory: When you need perl, think -- Learn it! -- Read about it! -- Testing with Perl -- O'Reilly Media Perl site -- Perl community news - The Perl Journal. "Founded in 1996 by Jon Orwant, The Perl Journal has been the leading publication for and about Perl programming." -- Perl for Win32 (the most widely-used port for Win32) -- Indigo Perl, Perl for Win32 with an integrated Apache web server -- An online Perl magazine -- a hangout/helpdesk for Perl programmers -- helpful site with useful links -- various tutorials - Creating Perl CGI Scripts - Perl/Tk Tutorial


news:comp.lang.perl.misc (Suggested posting guidelines: )



and others...

Note that comp.lang.perl was rmgrouped on 8 August 1995*. Some carelessly-administered news servers still carry it, unfortunately. Go to news:comp.lang.perl.misc instead.

On Wiki:

Perl Database Iteration Problem -- a Wiki implementation problem


Mac Perl = implementation for Mac's pre-Mac OS X. The standard perl distribution runs on Mac OS X (and is included by default)

I would like to see here an independent account, in brief, of what Perl is, what Perl is supposed to do, what it actually does, and what it does not do. The latter is the sort of thing books (and promotional material) tend not to mention!

That's difficult, because Perl does everything. Going to doesn't give any obvious hints to the starter, and going to shows you some neat T-shirts you can buy. Contrast this with Ruby Language, and especially Python Language, where the home page at challenges you to "learn Python in an afternoon!" But Perl isn't so hard to learn, or learn about. There just isn't a single obvious path to take for Learning Perl (which is very apt, as There Is More Than One Way To Do It is a key theme in perl ;) ). You can take a course in Perl from many colleges nowadays, or you can buy O'Reilly Media's "Learning Perl," one of the Definitive Perl Books.

''Try this description on for size: DESCRIPTION Perl is a language optimized for scanning arbitrary text files, extracting information from those text files, and printing reports based on that information. It's also a good language for many system management tasks. The language is intended to be practical (easy to use, efficient, complete) rather than beautiful (tiny, elegant, minimal). ''

Perl is the glue that binds the web together -- TimOReilly

And while it's not the only language used on the web (by far), the key word is glue. Perl is great for taking two applications, and gluing them together to get the job you want done, done. These applications might be console/stdin/stdout-, database-, web-, or IP- based (and others), but Perl makes it easy to get them to communicate and share data, making a new "uber-application".

If you're looking for advocacy, well, Perl is too comfortably established for that, but perhaps Why Love Perl and Why Hate Perl pages will spring up.

Perl is brilliant for fairly thin tasks, tasks that involve ripping through data files and juggling text in messy ways. But it is not strong as an algorithmic language. Attempting to do coursework from Data Structures 101 in Perl would be ugly. Just look at the section on references in the Camel book and run away screaming.

You think? C like structs map easily to hashrefs. So to insert a new node in a linked list, say, you'd do something like:

my $new_node = { NEXT => $cur_node->{NEXT}, CONTENT => $content }; $cur_node->{NEXT} = $new_node;

I say this as someone who loves the power and flexibility of perl: the syntax is just heinous. The syntax sugar for eliding quotes in hashes is nice, yes, but having to use all of the sigil, the arrow, AND the curly braces just to dereference an element is just wrong on so many levels. I feel javascript got it right, making the dot and subscript operators equivalent. But not only do you not get that with perl, due to perl's nasty little context rules, you don't even get the same subscript brackets for arrays and hashes. I do use $$cur_node{NEXT} myself (which is always perfectly safe with 'use strict' on), but I am really tired of leaning on my shift key to write perl.

If people want to do 'proper' Computer science with Perl, they should check out Mastering Algorithms With Perl. This isn't an ad - I'm just a humble biologist trying to spread the word.

Except of course you'd wrap all that up in an object. And implementing a linked list in perl is generally a silly thing to do since perl arrays grow and shrink as required and allow insertion/deletion of data in the middle of the array and generally do all the things you'd want a linked list for in the first place. Heaps, BTrees, Tries and all the rest of the data structure menagerie can be done in perl and have often been implemented already in CPAN (I recently grabbed a rather useful Heap implementation, making my priority queue a doddle to implement...)

Perl's basic data types (scalars, arrays and hashes) are quite advanced compared to other so-called

industry-standard languages such as C++. Once you get familiar with the concepts and the notation, the benefits become visible. Just try to convert one of your recent Perl programs to C, C++ or Java to be convinced! In addition, the language has additional builtins like *map* and *grep* which enables the programmer to code simple tasks in a concise way, avoiding loops and explicit coding. Those functions come from idioms encountered in the real world and which have been incorporated in the language because programmers have a need for them. See for example the defined-or operator (//=) for which a patch is already available. -- Philippe Causse More info at:

You can do it all in Perl, but there comes a point where it simply becomes a lot of trouble. It's common, for example, to end up with lists of lists or arrays of hashes, but then you get into reference hell and you're constantly having to think about whether something needs to be referenced or dereferenced. I've been coding in Perl for years (on and off, Ruby Language is my fave these days) and the referencing game still trips me up.

The trouble, I'd wager, is that people tend to think in terms of 'lists of lists' or 'arrays of hashes' instead of the more appropriate "lists of reference-to-a-list's" and "lists of reference-to-a-hash's". Unfortunately, most of the Perl literature helps to perpetuate this sort of confusion - at least initially. I've found that retooling my understanding of what is actually stored in a list (or in the value of a hash, for that matter) has cleared up nearly all of my confusion. I now find references no more confusing (and in fact, less so) than pointers in C. Which, depending on the reader, may not be much encouragement...

Personally, I find them "no more confusing" than references (although the VM wants to tell you they're pointers) in Java. ;)

They aren't pointers unless you can do arithmetic on them. Which is impossible in both Java and Perl, because that really screws up garbage collection. References, well-behaved little opaque data types that they are, can be counted and followed and used to find things that aren't referred to by anything still living. C and C++ don't provide a garbage-collected runtime, so they give you pointers. Perl and Java do, so all they give you are references.

Design Patterns only found in Way Back Machine. Any new links for a list of Perl based patterns? -- David Liu

I've been programming in perl for about 10 years and I keep forgetting about autovivication whenever I'm building a nested hash structure, and keep testing for membership, creating an empty list (or hash) if necessary, then assigning to it. Probably because the other languages I've worked with don't support autovivication. -- lastedit (remove next time)

The other thing I see lots of perl hackers do is fail to use the 'method object" syntax and only ever use 'object->method". The justifications for this that the former is ambiguous just don't fly with me -- in any one context, you shouldn't be using ambiguous types anyway, and anything that can reduce the syntactic noise is a really good thing. -- lastedit (remove next time)

The indirect object syntax is ambiguous to Perl's parser; it's too sensitive to the order in which you've defined barewords. Perl 6 fixes this by requiring a postfix notation on invocants in ambiguous cases. In Perl 5, unless you know when and how indirect invocation can fail, you oughtn't use it.

Perl has its faults, but it certainly is very powerful compared with more pedestrian languages. Usually it's more a question of what you program, than which language you use. My last big struggle in perl was adapting Alice Bot to a whole new application area (i.e. changing both its "database" and also changing/adding lots of perl code to it, while giving it an interactive web interface), and although painful, it was fairly stimulating. I was helping someone out, wouldn't have done it by myself. Learned a lot more about Perl in the process. I am not so much inclined to sneer at it anymore, it has some very strong points. definitely demands a look at.

Is it just me, or does Perl's official logo look unmistakably similar to the official logo of the Onion News Network? Compare:


Simplified Wrapper And Interface Generator (SWIG) can be used to make calls to Cee Language or Cee Plus Plus code.

See original on