Perl Programming

From Wikibooks, the open-content textbooks collection

(Redirected from Programming:Perl)
Jump to: navigation, search


Perl is a programming language designed by Larry Wall, known today for its strong community and module archive CPAN. It was originally developed to process text and produce reports. As a result, a backronym has been formed from its name: Practical Extraction and Report Language. It makes extensive use of significant punctuation, and highly chaotic-looking code has been written in it. This has resulted in a less complimentary backronym (which is still embraced by Perl users): Pathologically Eclectic Rubbish Lister (said to be a quote from the language designer himself).

Perl is Free Software, available under the Artistic License and the GPL. It was developed on Unix, and its Unix roots are pervasive. Perl is available for most operating systems but is particularly prevalent on Unix and Unix-like systems, and is growing in popularity on Microsoft Windows systems. However, it has been ported to a multitude of environments (some say as many as Java). It's a popular systems administration tool in Windows. Most of the things done in Perl transfer well from one operating system to another (provided suggested conventions are followed).

As an example of Perl in action, until January 2002 the software running Wikipedia was a CGI script written in Perl (Usemod programmed by Clifford Adams; still available at http://usemod.com).

Another example is Slashdot, which runs on the Perl-based Slashcode software.

When used on the web, Perl is often used in conjunction with the Apache web server and its mod_perl module. This embeds the perl binary into the webserver so the CGI script need not fire up a new copy each time it's accessed. Other features such as database connection persistence greatly reduce the access times to the page.

History of Perl

[edit] Beginning Perl

Getting Started
Editors and IDEs
First Program
Strings
Numbers
Making choices: if and else
Doing things over and over: while and for loops
Operators
Variables
Data Types
Scalar Variables
Array Variables
Hash Variables
User I/O
Advanced Output
Filehandles
Statement modifiers
Functions
Exercises

[edit] In-depth Perl ideas

Programming Structure and style
References and Data Structures
Regular Expressions
Regular Expression Operators
Regular Expressions Reference
Code reuse (modules)
Perl Objects

[edit] Interfacing Perl

GUI and desktop programming
CPAN
DBI - Perl Database Interface

[edit] CGI and Apache

CGI
mod_perl
HTML::Mason

[edit] Perl and beyond

Perl 6
Humour

[edit] Sample code

First example code to get you started
Second example code to get you started

[edit] Reference

Function Reference
Useful Modules
Quick-reference cards
Websites
Personal tools