Softpanorama
May the source be with you, but remember the KISS principle ;-)

Contents Bulletin Scripting in shell and Perl Network troubleshooting History Humor

Introduction to Perl 5.10 for Unix System Administrators

(Perl 5.10 without excessive complexity)

by Dr Nikolai Bezroukov

Contents : Foreword : Ch01 : Ch02 : Ch03 : Ch04 : Ch05 : Ch06 : Ch07 : Ch08 :


Chapter 1: History of Perl and Perl Programming Environment Overview

Note: This is unpublished copyrighted material  licensed under the Creative Commons Attribution-NoDerivs-NonCommercial License.

Prev | Up | Contents | Down | Next

1.1. Perl History and Evolution


Creator of Perl Larry Wall is a pretty interesting figure on the open source/free software arena. Designing the language and writing first Perl interpreter was a really huge project. Unlike Linux Torvalds Larry Wall did not have POSIX standards before him to solve architectural problems although Unix shell languages and AWK provided some guidelines. Perl interpreter was not his first freeware effort -- before it he created a popular USENET newsreader rn and several other programs like patch. But no matter what is your level of qualification and talent the development of the language of this level of complexity is really an exhausting full time job.

His personal site is www.wall.org. The little known fact is that he created all his programs including Perl being almost completely blind on one eye. Recently he published a diary relating details of his cornea transplant surgery that improved his vision. Unfortunately his health problems were not limited to his mishap. In 2004 he undergone the operation that removed a tumor from his stomach. See Portraits of Open Source Pioneers for additional information.

Language started as with version 2 and is now with version 5. Being 25 years old language is an achievement in itself. Being installed by default in all major flavors of Linux and Unix is another achievement.

Perl evolution: major versions of Perl 5

Perl is not a static language. Like all programming languages it evolves with time. Generally a typical programming language gets to a new version in 10 to 12 years. Perl is now in version 5 that was initially released in late 1994.   Actually for the last 10 years Perl changed very little as resources for its development became minimal after O'Reilly withdraw its support around 2002. Perl does not have an influential corporate sponsor like Python have found in Google and Microsoft. Still despite lack of funds the development progresses and language is evolving at above average speed.

Despite slow page of changes Perl as we used to know in say 1996 is somewhat different from a typical versions of Perl deployed in 2012 (which encompass versions 5.8 to 5.16). Some facilities are added. Some became obsolete. Perl is installed by default on all major versions of Unix. The most popular are two versions: 5.8.8 and 5.10.1.

Among important version  widely in still widely on Unix (see Perl - Wikipedia):

Again in this ebook we will use version 5.10. Some on new features (for example when costruct can be emulated in version 5.8.8).

Early history

Perl is an acronym for "Practical Extraction and Report Language." The first version of Perl was developed by Larry Wall around 1987 and like in case of many other important algorithmic languages the development was partially financed by military.

"Blacker" project needed some C/AWK/SED superset and an attempt was made to add AWK and SED features to the C-shell framework. The idea was to create a language more convenient and more suitable for processing logs and generating reports for large quantities of data than combination of shell, AWK and C-shell. Design contains some elegant solutions and the language got some traction. Here how Larry Wall explains his decision:

At this point, I'm talking about Perl, version 0. Only a few people in my office ever used it. In fact, the early history of Perl recorded in O'Reilly's Camel Book (Programming Perl) was written by my officemate of the time, Daniel Faigin.

He, along with my brother in law, Mark Biggar, were most influential in the early design of Perl. They were also the only users at the time. Mark talked me out of using bc as a backend expression processor, and into using normal, built in floating point operations, since they were just being standardized by the IEEE (Institute of Electrical and Electronics Engineers). Relying on that standard was one of the better decisions I ever made. Earlier scripting languages such as REXX didn't have that option, and as a result they tend to run slower.

The very first version already contained a lot strong points and first of all the principle idea that the language should provide for special constructs optimizing the usage of common, most frequent idioms:

I made one major, incompatible change to Perl just before it was born. From the start, one of my overriding design principles was to "optimize for the common case." I didn't coin this phase, of course. I learned it from people like Dennis Ritchie, who realized that computers tend to assign more values than they compare. This is why Dennis made = represent assignment and == represent comparison in his C programming language.

I'd made many such tradeoffs in designing Perl, but I realized that I'd violated the principle in Perl's regular expression syntax. It used grep's notion of backslashing ordinary characters to produce metacharacters, rather than egrep's notion of backslashing metacharacters to produce ordinary characters.

It turns out that you use the metacharacters much more frequently than you do the literal characters, so it made sense to change Perl so that /(.*)/ defined a substring that could be referenced later, while /\(.*\)/ matched a sequence inside literal parentheses.

Perl 2.0 was release in June 1988 (coincidentally simultaneously with SPARCstation 1 which along with SunOS became the machine for Perl ensuiasts.

Release as open source

Perl 3.0 was released in 1989 was distributed under GNU public license -- one of the first major open source project distributed under GNU license and probably the first outside FSF.

The decision to release it as free open sourced software was also a brilliant and in 1989 not an easy one:

I knew that I didn't dare ask the company lawyers for permission, because they'd have thought about it for something like six months, and then told me "no." This is despite the fact that they wouldn't be interested in peddling it themselves. In the old days, a lot of free software was released under the principle that it's much easier to ask forgiveness than to seek permission. I'm glad things have changed -- at least to the extent that the counterculture is acknowledged these days, even if it's not quite accepted. Yet.

Perl 4

In January 1991 the first edition of Programming Perl, a.k.a. The Pink Camel, by Larry Wall and Randal Schwartz is published by O'Reilly and Associates. It described a new, 4.0 version of Perl. Simultaneously Perl 4.0 was released (in March of the same year).  Final version of Perl 4 was released in 1993. Larry Wall is awarded the Dr. Dobbs Journal Excellence in Programming Award. (March)

Perl 5 was released in 1994.

See excellent Perl Timeline for more information. In the paper Linux Magazine October 1999 FEATURES Uncultured Perl Larry Wall wrote:

Like the typical human, Perl was conceived in secret, and existed for roughly nine months before anyone in the world ever saw it. Its womb was a secret project for the National Security Agency known as the "Blacker" project, which has long since closed down. The goal of that sexy project was not to produce Perl. However, Perl may well have been the most useful thing to come from Blacker. Sex can fool you that way.

Perl 5 period

Perl 5.000 was released on October 17, 1994. It was almost complete rewrite of the interpreter and introduction of substantial changes to the language. Among new constructs added were references, namespaces, new type of local variables (my) variables, and modules.  New functions include: abs(), chr(), uc(), ucfirst(), lc(), lcfirst(), chomp(), glob(). There is now an English module that provides human readable translations for cryptic variable names. Modules can be loaded via the new keywords use. Pattern matches may now be followed by additional modifiers including "multiline match" semantics. An s modifier makes . match newline.

This release happened "just in time" for the World Wide Web revolution. WWW has dramatically raised the visibility of Perl 5 around 1996 -- to certain extent at the expense of TCL and other Unix-based scripting languages, although WEB also produced several Perl competitors like JavaScript and PHP. Due to the Web Perl has become one of major programming languages for Internet  and for some period dominated Web scripting practically like VB dominates Windows scripting arena. Later it was displaced in this role by PHP -- a Perl derivative that is vastly inferiors language in comparison to Perl, but that adhere more strictly to C syntax.  As it was well integrated with Apache and you can write PHP code directly in HTML files it became new "duct tape of the Web" instead of Perl.

Version 5 was introduced and generally coexisted with Perl 4. It became the primary version of Perl in early 1995 (just before Java). This was huge effort of the part of Larry Wall. As he remarked later:

For Perl, the meltdown happened because I decided to follow the rule: "Plan to throw away your prototype, because you will anyway." Perl 5 was nearly a total reorganization. I have in times past claimed that it was a total rewrite, but that's a bit of a stretch, since I did, in fact, evolve Perl 4's runtime system into Perl 5's. (Though if you compared them, you'd see almost nothing in common.) The compiler, though, was a total rewrite.

Although Perl implementation is an open source implementation, commercial companies actively participated in its development. The major commercial beneficiary of Perl success was O'Reilly & Associates that published first books on the language (Programming Perl and Learning Perl in 1993). At the peak of Perl popularity it sold millions of dollars worth of Perl books each year. They also tried to distribute extended Perl distribution called Perl Resource Kit. For some time they provided financial support for the Perl movement. From 1995 to 2002 they employ Larry Wall. O'Reilly also hosted Perl web site and sponsored a Perl conference.

Loss of O'Reilly patronage and failure to keep its status of primary Web development language

PHP -- an ugly and primitive language had chosen the right area of specialization -- web pages and soon (by and large due to its primitivism in style of Basic) get substantial following as it was the easiest language for those who developed some pages in HTML top start to add elements of programming to their Web site.

This was unfair development but life if often unfair.  Also around 2000-2001 with the burst of dot-com bubble the computer book publishing bubble was also burst and as a result O'Reilly lost large chunk of its revenue. Like Perl it never recovered.

Due to the fact that Perl books became much less profitable, around 2002 O'Reilly lost interest in Perl and the same year Larry left O'Reilly.  Here is pretty a telling quote by Bill O'Reilly himself from Is Perl Still Relevant - O'Reilly Media (July 2005 )

In terms of the competitive landscape among programming languages, in addition to PHP, Python has long been gaining on Perl. From about 1/6 the size of the Perl market when I first began tracking it, it's now about 2/3 the size of the Perl book market. The other scripting language (in addition to Perl, Python, and PHP) that we're paying a lot more attention to these days is Ruby. The Ruby On Rails framework is taking the world by storm, and has gone one up on PHP in terms of making database backed application programming a piece of cake.

With O'Reilly divesting from Perl lost an important corporate sponsor. It never acquired another. Development needed to be moved to by-and-large volunteer basis (althouth Active State did develop Microsoft Windows version of Perl as a commercial organization).

May be due to this after 2002 (when version 5.8 was released) Perl development dramatically slowed down and the next version (5.10) was released only in 2007. After that Perl development reacquired some of its former dynamic and we saw versions 5.12, 5.14 and 5.16 released in three consecutive years.

Serous sickness of Larry Wall and the end of active development of the language

In 2004 Larry Wall undergone the operation that removed a tumor from his stomach. See Portraits of Open Source Pioneers for additional information. That was an end of Larry Wall role of the primary developer of the language and serious difficulties with the path of the language followed. Ambitious Perl 6 project was launched with no resources and no real new leader of Larry Wall caliber. Perl 6 has harmed Perl, and many Perl programmers as it introduced element of FUD in the whole Perl ecosystem.

Also the party of Perl complexity junkies became more prominent in Perl development community then it should be. It did not produce much of value but it scared a lot of people who otherwise would use Perl. I especially hate their misplaced OO fanaticism  and its result in Perl standard modules which now are somewhat dangerous to use because of bugs introduced due to OO conversion (I do not consider developers who wave OO banner too much to be honest -- most of this type of people who I know personally are corrupt; that does not mean that all of then are dumb. Like corrupt bankers some of the them are pretty bright and still do their evil things for the sake of personal advancement at the expense of society at large ;-).

If you look at the language changes from 2002 it is clear that the only important language feature introduced was state variables in version 5.10. That suggest crisis in Perl development leadership, the crisis typical for a large open source project who lost its original leader. Perl is not the first and not the last with those problems. Eventually viable projects get back on track albeit in more modest way. I hope than this is happening with Perl.

Some Resurgence of Perl in Bioinformatics

Around 2002 Perl became popular in a new field -- bioinformatics. The importance of programming in biology stretches back to at least late 90 with the genome decoding efforts.  And it certainly has a significant future now that it is a recognized part of research into many areas of medicine and basic biological research. This may not be news to biologists. But Perl programmers were surprised that their favorite language has become one of the most - if not the most popular - of programming languages used in bioinformatics. See RFC Bioinformatics Tutorial and L. Stein. How Perl saved the Human Genome Project. The Perl Journal. 

Perl heritage

Perl remains not only the primary language for senior Unix sysadmins. Being more then 25 years old it is now historically important scripting language. That does not mean that it is already dead like PL/1. I would not try to write a book if this was true. On the contrary, Perl 5 archived status of a mature language that is included by default with all flavors of Unix.

But 25 years of development permit to view the historical importance of the language and its place among similar live and already dead programming languages.

From the historical point of view Perl is a sibling of C-shell and AWK. The repertoire of built-in function remind AWL. While syntax resembles C with some important shell innovations added.

That means that those who know shell programming feel that they can adapt to Perl without major problems. That's why many UNIX sysadmin find Perl (deceptively) easy to learn. In reality Perl is a very complex language with a complex semantic. The slogan of Perl...."There's always more than one way to do it." is essentially the same idea that inspire the designers on PL/1 and it would definitely find home in hearts of designers of MS Office ;-). Different Perl programmers may use different approaches even for simple problem.

In this sense Perl can be considered a very important development: anti-Unix (countercultural) development within the Unix culture  ;-). And Larry Wall agree with this:

But Perl was actually much more countercultural than you might think. It was intended to subvert the Unix philosophy. More specifically, it was intended to subvert that part of Unix philosophy that said that every tool should do only one thing and do that one thing well.

The problem with that philosophy is that many of the tools available under Unix did not, in fact, do things very well. They had arbitrary limits. They were slow. They were non-portable. They were difficult to integrate via the shell because they had different ideas of data formats. They worked okay as long as you did what was expected, but if you wanted to do something slightly different, you had to write your own tool from scratch.

So that's what I did. Perl is just another tool in the Unix toolbox. Perl does one thing, and it does it well: it gets out of your face.

But it is very interesting to note that Perl has one very unlikely precursor (I do not know whether Larry Wall ever worked on mainframes). When I first encountered Perl I was surprised how many of underling ideas of Perl are close to PL/1 -- the language that served as one of the inspirations for the C and despite being a mainframe language historically related to the Unix culture via its Multics roots. PL/1 was innovative language that was too far ahead of its time to survive. It was the first language that contained good string handling, exception handling, rudimentary multitasking. It was and probably still is one of the most interesting algorithmic languages in existence, although it's popularity (similar to popularity of many other interesting IBM products with VM/CMS and OS/2 and examples) that suffered blows from IBM itself and in 70th from religious fanatics in the days of structured programming and verification. What is most interesting that despite its age PL/1 has probably the best optimizing and debugging compilers for any language of similar complexity in existence. IBM optimizing and debugging compilers for PL/1 on system 360/370 remain an unsurpassed masterpiece of software engineering. They will always be remembered along with FORTRAN H and PL/C compilers.

Probably the major killing factor was that compiler for PL/1 was too complex for many organizations to re-implement (it is probably close to similar to C++ compilers in complexity). No free compiler existed although Cornell University managed to implemented PL/C -- a pretty full teaching subset of PL/1 and successfully use it for a number of years. Even later simplified version called PL/M was not able to withstand the competition with free C compilers. I wonder what would happen to PL/1 if IBM released the compiler under some king of open source license. BTW currently the quality of Perl interpreter is much less that PL/1 debugging compiler.

Paradoxically, PL/1 compilers were used as open source free products in Eastern Europe and the USSR. And it is interesting to note that it really dominated mainframe programming in the USSR, far outpacing Cobol and Fortran that still dominate the mainframe arena in the USA and other Western countries. So here analogy with Perl hold perfectly. Moreover PL/1 dominated despite the fact the Soviet IBM 360/370 clones (called EC -- Russian abbreviation of "Uniform System of Computers") were less powerful (and less reliable) that Western counterparts.

I would like to stress that PL/1 (as a system programming language for Multics) has large influence on C -- one of the most widely used compiled programming languages and many of it's ideas directly or indirectly found its way into other programming languages (I have no information about Larry Wall possible exposure to PL/1) can be found in Perl. IMHO understanding if not PL/1 programming, but PL/1 philosophy -- or its close relative Perl philosophy can benefit programming community much more that playing with languages based on some kind of religious doctrine like pure strongly type languages or OO languages ;-).

There were several versions of Perl but that most important are version 4 and version 5 (released in 1995). The latter is still the current version of the language. Version 4 was widely available before WEB explosion in 1994.

Another thing that helped legitimize Perl was the addition of the Artistic License to stand beside the GPL. Perl 3 used only the GPL, but I found that this didn't do quite what I wanted. I wanted Perl to be used, and the GPL was preventing people from using Perl. Not that I dislike the GPL myself -- it provides a set of assurances that many hackers find comforting. But business people needed a different set of assurances, and so I wrote the Artistic License to reassure them.

The really brilliant part was that I didn't require people to state which license they were distributing under, so nobody had to publicly commit to one or the other. In sociological terms, nobody had to lose face, or cause anyone else to lose face. Most everyone chose to read whichever license they preferred, and to ignore the other. That's how Perl used psychology to subvert the license wars which, as you may or may not be aware, are still going on. Ho hum.

Yet another thing that helped legitimize Perl was that there was a long period of stability for Perl 4, patch level 36. The primary cause of this was that I abandoned Perl 4 to work on Perl 5.

Prev | Up | Contents | Down | Next




Etc

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available in our efforts to advance understanding of environmental, political, human rights, economic, democracy, scientific, and social justice issues, etc. We believe this constitutes a 'fair use' of any such copyrighted material as provided for in section 107 of the US Copyright Law. In accordance with Title 17 U.S.C. Section 107, the material on this site is distributed without profit exclusivly for research and educational purposes.   If you wish to use copyrighted material from this site for purposes of your own that go beyond 'fair use', you must obtain permission from the copyright owner.

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Haterís Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least


Copyright © 1996-2014 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Site uses AdSense so you need to be aware of Google privacy policy. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to make a contribution, supporting hosting of this site with different providers to distribute and speed up access. Currently there are two functional mirrors: softpanorama.info (the fastest) and softpanorama.net.

Disclaimer:

The statements, views and opinions presented on this web page are those of the author and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.

Last modified: February 19, 2014