About Perl

Perl is a wicked language created by Larry Wall. His homepage tells us a bit about his personality.

Perl is a dynamically typed interpreted language (also categorized as a "scripting" language) and is widely used on UNIX or Linux systems. It is slowly making a niche for itself on Windows. Perl is especially good at treating strings and made CGI scripts possible at the beginning of Internet. Because of that, it could be considered the first of the WebLanguages. It has since evolved and is now used is many kinds of fields as explained by this book from O'Reilly Publishing. See How Perl Saved the Human Genome Project for an interesting story.

People love Perl or they hate it. There is rarely an in-between. I think the general consensus is that Perl is good at performing small applications, but becomes very painful when used in bigger projects. It's common to hear things like "Perl is interpreted line noise" or "Write once, change never." Perl's awkward syntax has its roots in the standard Unix tools like sed, awk and the Unix shell, to which it adds many features. Perl is not designed to be small and elegant, but practical, and its practitioners sometimes call it "the chainsaw". Perl benefits from a huge library of code snippets, the Comprehensive Perl Archive Network (CPAN), and of a lot of support worldwide. The language itself is in constant evolution.

Obfuscated Perl

When people compare Perl to line-noise, they usually know what they are talking about. Here is piece of obfuscated Perl:

$0=s#.*[/\\]##g;push@ARGV,"-h--Te_-JPerourl";$_=shift;@4=@1=@3=@2=@[=split(//);/
_/g;$;=pos;$$=sub{eval"(\$$\\[$;\],\$$\\[$\"+$;\])=(\$$\\[$\"+$;\],\$$\\[$;\]);\
@\[\[$\"+$;\].=join\"\",\@$\ ;\$\\++"};$\++;$;--;$"--;$;%4>0&&&$$;$"+=2;$;%4<3&&
&$$;$"-=5;$;>3&&&$$;$"+=8;$;<12&&&$$;$\--;for(@[){s}(.)(.+)}<TD><a href=\"$0?$2\
">$1</a>}g;s@^(.)$@<TD>$1@g;s]>_]> ]g}for(0..3){@[[$_<<2]="<TR>".@[[$_<<2]};$$=l
ocaltime;print "Content-Type: text/html\n\n<html><body><table border=2>",@[,"<TD
>nal</table>$$<p></body></html>

This is perfectly valid Perl program of a sliding puzzle CGI script.

Perl poetry

Some people love Perl so much they write poetry with it. This sweet example of Sharon Hopkins figures in the "Programming Perl" book.

APPEAL:
listen (please, please);
    open yourself, wide;
    join (you, me),
    connect (us,together),
tell me.
do something if distressed;
    @dawn, dance;
    @evening, sing;
    read (books,$poems,stories) until peaceful;
    study if able;
    write me if-you-please;
sort your feelings, reset goals, seek (friends, family, anyone);
        do*not*die (like this)
        if sin abounds;
keys (hidden), open (locks, doors), tell secrets;
    do not, I-beg-you, close them, yet.
                accept (yourself, changes),
                bind (grief, despair);
    require truth, goodness if-you-will, each moment;
select (always), length(of-days)

PerlLanguage (last edited 2008-07-09 05:48:16 by localhost)