28 March 2013

By Sam Hughes

Perl is a dynamic, dynamically-typed, high-level, scripting (interpreted) language most comparable with PHP and Python. Perl's syntax owes a lot to ancient shell scripting tools, and it is famed for its overuse of confusing symbols, the majority of which are impossible to Google for. Perl's shell scripting heritage makes it great for writing glue code: scripts which link together other scripts and programs. Perl is ideally suited for processing text data and producing more text data. Perl is widespread, popular, highly portable and well-supported. Perl was designed with the philosophy "There's More Than One Way To Do It" (TMTOWTDI) (contrast with Python, where "there should be one - and preferably only one - obvious way to do it").

Perl has horrors, but it also has some great redeeming features. In this respect it is like every other programming language ever created.

This document is intended to be informative, not evangelical. It is aimed at people who, like me:

  • dislike the official Perl documentation at http://perl.org/ for being intensely technical and giving far too much space to very unusual edge cases
  • learn new programming languages most quickly by “axiom and example”
  • wish Larry Wall would get to the point
  • already know how to program in general terms
  • don’t care about Perl beyond what’s necessary to get the job done.

This document is intended to be as short as possible, but no shorter.

Preliminary notes

The following can be said of almost every declarative statement in this document: "that's not, strictly speaking, true; the situation is actually a lot more complicated". If you see a serious lie, point it out, but I reserve the right to preserve certain critical lies-to-children.

Throughout this document I'm using example print statements to output data but not explicitly appending line breaks. This is done to prevent me from going crazy and to give greater attention to the actual string being printed in each case, which is invariably more important. In many examples, this results in alotofwordsallsmusheduptogetherononeline if the code is run in reality. Try to ignore this.

Read more: www.chenzixin.com or qntm.org.



blog comments powered by Disqus