SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
Register your product to gain access to bonus material or receive a coupon.
Presents students with an ideal text package that goes beyond mere reference with a thorough, yet concise study on Perl. Ex.___
Offers students easy accessibility and does not tie them down to using a particular program. Ex.___
Gives students ample and periodic opportunity to hone up on concepts covered as they progress; provides instructors with convenient assignment options. Ex.___
Perl is a programming language of growing significance in the world of software development. A Little Book on Perl meets that growing academic market need for Perl books. This book attempts to target experienced programmers, whether that experience has come from professional programming or from the first two courses in a degree program in computer science. Neither a comprehensive reference book nor a tutorial, this book lands somewhere in the middle of these two models. The reader's advantage is a new model-no need to have prior knowledge of awk or C, or even anything about UNIX-since the contents of the book do not depend on any particular computer platform.
1. Introduction.
2. Scalar Types, Expressions, and Simple Input and Output.
3. Control Statements.
4. Arrays.
5. Hashes and References.
6. Functions.
7. Pattern Matching.
8. Files, Input and Output, and Formats.
9. CGI Programming with Perl.
10. Advanced Topics.
This is a book on the widely used programming language, Perl. It includes both descriptions of the features of the language, and how they can be used to write useful programs. As is usually the case with books on programming, the examples are small and are designed to illustrate one or a few language capabilities. Larger, more complex programs often drown the features the book is trying to show, just by their size and structure.
The goal of the book is to provide a clear and concise description of Perl for someone who has programmed in some other programming language and wants to learn to use Perl. In many ways, Perl is similar to other programming languages; in some other ways, it is very different. We point out, whenever it is relevant, the advantages Perl offers over alternative languages.
Perl has been for some time the most widely used UNIX system administration language. It is now also the most popular scripting language for writing Common Gateway Interface (CGI) programs. In recent years, Perl has begun to replace C for many smaller programming tasks, especially if large files of text must be processed. Because of these varied applications of the language, there is now a large number of Perl users. Due to the dramatic rise in popularity of the World Wide Web and, consequently, college courses that cover various aspects of it, including CGI programming, there is now an emerging academic market for Perl books. However, most, if not all, currently available books on Perl were written for the professional programmer. This book attempts to target experienced programmers, whether that experience has come from professional programming or in the first two courses in a degree program in computer science or a closely related field.
Perl is neither small nor simple. It is a complicated combination of the features and capabilities of previous languages, such as sed, awk, and C, along with a few new ideas of its own. Although Perl is powerful, it is relatively easy to learn enough of the language to write programs that describe significant processing, although the programs themselves are rather small.
This book is neither a comprehensive reference book nor a tutorial. Reference books about languages contain all of the details of the language, but usually in a form that is difficult to read. It is difficult to learn a programming language from such a book; it is like trying to learn English by studying a book on English grammar. On the other hand, tutorial books on programming languages often aim too low-they assume the reader knows little about programming languages and programming. Seasoned programmers, both professional and from collegiate experience, find such books boring and tedious, for they too often waste several paragraphs on the obvious.
Our intention is for this book to be between these two models. It will not cover every detail of Perl, nor will it provide an introduction to computers, programming, or programming languages. It is not for those who want to become Perl experts; they will still need a Perl reference book. On the other hand, it is not for those who want to learn just a bit about Perl to enable them to write (and read) a few relatively small and simple programs. Those people will want a brief tutorial that leaves out all of the advanced features.
Because the book is aimed at professional programmers and college students who have had at least two courses in programming, it gets to the point quickly, with little discussion of background topics such people should already know. The book will not assume that the reader knows awk or C, or even anything about UNIX. Of course, prior knowledge of awk or C will make learning Perl much easier. We have tried to make the book platform independent. Most Perl constructs work the same way on all platforms, including UNIX, Windows, and Macintosh. In those cases where there are differences, we point them out to the reader.
One of the unique features of this book is the sample program that appears in Chapter 1, before any details of Perl have been discussed. This is not a "hello world" program-it actually does something useful. It is followed by a brief line-by-line explanation of its statements. We hope this example will motivate the reader with both the power and brevity of Perl. It provides the reader with a quick look at a complete program, without first dragging him or her though a tedious discussion of the basics of Perl.
The book includes many code segments. Each of the 10 chapters has at least one complete program. The book does not contain descriptions of all of the Perl functions-these can be found on Web pages to which the book will refer. The book will not focus on UNIX system administration; rather, it will concentrate on Perl as a programming tool, which can be used for a variety of tasks. Because we believe that the number of PC Perl users is growing, we will not spend a great deal of time with UNIX-particular details at the expense of those PC users.
The programs and code segments in this book were developed and tested using Perl 5. Note that when we say "Perl" we mean the language and when we say "perl," we mean the Perl language-processing system (a compiler and an interpreter).
The first chapter provides some overview of the purposes and origins of Perl. It also provides an introduction to what CGI programming is. Most importantly, it includes an example of a Perl program, including a brief description of each of its statements. Chapter 2 describes the small-scale features of Perl, covering enough constructs to allow small programs to be written. Chapter 3 describes most of the control statements. Chapter 4 covers Perl's arrays, which are more flexible and powerful than those of other popular programming languages. Chapter 5 describes hashes (which are data structures for storing keyed table information) and references (which provide some of the benefits of pointers without their inherent dangers). The anatomy of Perl's functions is the topic of Chapter 6, including some of the predefined functions. The powerful pattern-matching facilities of Perl are described in Chapter 7, which includes many small fragments of code that illustrate their power and flexibility. Files, file tests, and formats are described in Chapter 8. Chapter 9 provides the information required to write CGI programs in Perl, including the use of the convenient CGI. pm module. Included in Chapter 9 are several complete sample CGI programs. Finally, Chapter 10 has brief descriptions of six advanced topics of Perl that do not fit nicely into any of the previous chapters. Among these are how other programs can be launched from Perl programs, how a Perl program can communicate with other computers, and how graphical interfaces can be added to Perl programs using Tk.
This book is meant to support a one- or two-semester, or junior level. The reader is expected to have had as a minimum an introductory course in programming and a course in data structures, or their equivalents in industrial experience. The book is also designed to be used as a supplement in courses on programming the World Wide Web.
For short courses, the last two chapters could be skipped. For longer courses, the last two chapters could be covered and perhaps given further attention through supplemental material on CGI and some of the advanced aspects of Perl.
Perl is a programming language of growing significance in the world of software development. Many professionals should learn it, so that they can correctly recognize applications for which it is the best language choice and so that they can use it in those areas in which it has become virtually essential: CGI and systems administration. This book could be used in self-taught mode, although some instruction should be helpful.