Path: utzoo!attcan!uunet!mailrus!cornell!uw-beaver!fluke!inc From: inc@tc.fluke.COM (Gary Benson) Newsgroups: comp.lang.perl Subject: Re: What is perl? Summary: An exerpt from the online manual page, and personal observations. Message-ID: <1990Mar25.202138.12685@tc.fluke.COM> Date: 25 Mar 90 20:21:38 GMT References: <458@memqa.uucp> <745@idsssd.UUCP> Organization: John Fluke Mfg. Co., Inc., Everett, WA Lines: 128 In article <745@idsssd.UUCP>, bruce@idsssd.UUCP (Bruce T. Harvey) writes: # In article <458@memqa.uucp>, qfhca81@memqa.uucp writes: ## ## Could someone email me a desription of the perl language. I've never ## heard of it before bringing up this newsgroup. # Absolutely! Me too! What is perl, and why does the world of usenet seem to # be switching over to this language? # # I'd love to know, and so would the other programmers here who've never heard # of it. Is it a BSD-ism? SUN-ism? OTHER-ism? As a budding programmer and novice perl user myself, I would like to respond. This question is asked regularly, so I wonder if a monthly posting might be in order. I realize that the original request for was for emailed information, but there seems to be enough interest to call for a posting. Those who have perl and can access the online documentation should just skip this article. The following extract is the first page of the on-line perl manual as it exists here at Fluke. Note that we are not up-to-date with the current patch level, but this first page is generic enough that not much (if anything) will change. NAME perl - Practical Extraction and Report Language SYNOPSIS perl [options] filename args DESCRIPTION Perl is an interpreted 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). It combines (in the author's opinion, anyway) some of the best features of C, sed, awk, and sh, so people familiar with those languages should have little difficulty with it. (Language historians will also note some vestiges of csh, Pascal, and even BASIC-PLUS.) Expression syntax corresponds quite closely to C expression syntax. Unlike most Unix utilities, perl does not arbitrarily limit the size of your data--if you've got the memory, perl can slurp in your whole file as a single string. Recursion is of unlimited depth. And the hash tables used by associative arrays grow as necessary to prevent degraded performance. Perl uses sophisticated pattern matching techniques to scan large amounts of data very quickly. Although optimized for scanning text, perl can also deal with binary data, and can make dbm files look like associative arrays (where dbm is available). Setuid perl scripts are safer than C programs through a dataflow tracing mechanism which prevents many stupid security holes. If you have a problem that would ordinarily use sed or awk or sh, but it exceeds their capabilities or must run a little faster, and you don't want to write the silly thing in C, then perl may be for you. There are also translators to turn your sed and awk scripts into perl scripts. OK, enough hype. Upon startup, perl looks for your script in one of the following places: 1. Specified line by line via -e switches on the command line. 2. Contained in the file specified by the first filename on the command line. (Note that systems supporting the #! notation invoke interpreters this way.) 3. Passed in implicitly via standard input. This only works if there are no filename arguments--to pass argu- ments to a stdin script you must explicitly specify a - for the script name. After locating your script, perl compiles it to an internal form. If the script is syntactically correct, it is executed. Printed 2/4/90 Release 3.0 Patchlevel 8 1 _-_-_-_-_-_-_-_-_-_-_-_-_end of manual page extract-_-_-_-_-_-_-_-_-_-_-_ This is the first page - the entire online manual is 65 printed pages; I don't think there is much value in posting the entire thing. Perl was designed and created by Larry Wall, and is distributed under the auspices of the FSF. The current version is Release 3 Patchlevel 15, with a Patch 16 apparently in the works. As a newcomer to programming, I cannot answer fully or accurately the question about why perl is gaining popularity so rapidly, but in my own experience, four features have been of enormous benefit: 1. Error messages are clear and accurate, usually even giving the exact line number where the problem exists (or started!). A built-in debugger lets you single-step through a program examining your variables and arrays as they get built. For a beginner, these features have enhanced my learning significantly. 2. Everything in the language seems self-consistent, but at the same time similar to other programs (like sed and awk) that perform the same or similar functions. There is even a program that converts awk and sed scripts to perl to aid people to make the transition! 3. Associative arrays are easy to work with, even for someone like me who did not know what one was two months ago. 4. This newsgroup! A few months ago, I posted a set of novice questions, and the response was overwhelming. One good reason for the success of the language is the way this group runs itself. It seems that even the rankest amateur (like me) is free to post his questions without fear of ridicule, and in fact, and even the most macho super gurus are not too busy to help answer them. The fact that Larry Wall writes regularly here is a definite benefit, and his active involvement in supporting his program probably has a lot to do with the growth of his exciting new language. I hope this partly answers your questions - and I hope that some of the more knowledgeable types will let us know their reasons for liking perl. I know that my novice perspective has a certain kind of value, but the answers of the more high-powered will probably be much more interesting. -- Gary Benson -=[ S M I L E R ]=- -_-_-_-inc@fluke.tc.com_-_-_-_-_-_-_-_-_- To simplify means to eliminate the unnecessary so that the necessary may speak. -Hans Hoffman