Originally released in 1987 as a scripting language to act as a go-between for making UNIX programs work together, Perl has since become the language of choice in pretty much any situation where a full-blown compiled language would be overkill. Automating UNIX system maintenance tasks, powering database-driven Web sites, and everything in between, Perl can be found hiding behind the scenes almost everywhere in the computer world today.
In addition to being one of the most versatile languages in existence, Perl has a reputation for being one of the most confusing. In “Beginning Perl”, Simon Cozens contends that the only thing confusing about Perl is that it takes a ‘natural language’ approach to programming — one that will be unfamiliar to anyone experienced with other C-style languages (such as C/C++, Java, or JavaScript). He also points out that, for some reason, Perl programmers tend to like to try to find the shortest, most efficient way to express everything in their programs — which leads to rather cryptic code in many cases.
Instead of avoiding these aspects of Perl, this book tackles them head on. By stopping to explain key differences between Perl and other popular languages and explaining commonly used coding tricks, it presents a complete and in depth description of the language that accommodates both the programming newcomer and the seasoned veteran.
“Beginning Perl” leads off with an introductory chapter describing the origins of the language and its attractive features, and providing a complete guide to downloading and installing it on both UNIX- and Windows-based platforms. With the preliminaries out of the way, the Perl language is briefly set aside at the beginning of the first chapter, where the reader is presented with a description of programming in general. If you’ve never written a program before in your life, this chapter alone should be one of the major selling points of the book. Experienced programmers may enjoy the author’s clever examples and analogies, but can safely skim through the description of how to create and run a simple Perl program that ends the chapter.
The next three chapters cover the basic language features: data types, variables, operators, and flow-of-control. This is necessarily the least engaging phase of learning any language, but the author’s conversational tone succeeds in keeping the pace lively. Readers familiar with other languages might be tempted to skim this section of the book, but would be well served to read it carefully. Some features of Perl that look deceptively like similar constructs in other languages actually contain subtle differences that are well highlighted by this book, and are vitally important to examples in later chapters.
With the basics covered, chapters 5 through 8 introduce and explain the advanced language features: regular expressions for powerful and flexible text manipulation, file and data handling facilities, variable references for dealing with complex data structures, and subroutines for organizing programs into reusable chunks of code. These chapters are of a uniformly high quality and don’t skimp on details as they cover the features that set Perl apart as a powerful yet elegant language suited to many different tasks.
Chapter 9 deserves special mention, as it signals a pause in the whirlwind tour of the Perl language and instead focuses on how you can make life easier for yourself as a Perl programmer. This chapter provides descriptions of and advice for correcting common error messages using the tools at your disposal and features of the Perl language itself. Especially valuable to beginners is a list of Perl error messages and common causes (and solutions!).
After a couple more chapters covering advanced language features (specifically, modules and object-oriented programming), the book presents two of the most common applications of Perl: CGI programming and Database manipulation. Shifting into high gear, the book provides a complete (but terse) overview of such topics as creating dynamic Web sites, plugging security holes in CGI scripts, installing a relational database (in particular, MySQL), and accessing that database from within a Perl program. Admittedly, these chapters are impressive in the amount of knowledge they impart in so limited a space (just over 100 pages), but with all the material that is covered, there just isn’t room for the friendly hand-holding that runs throughout the earlier chapters of the book. If you’re familiar with the concepts of server-side scripting and databases, then these chapters will provide an excellent guide to how these things can be done in Perl. Beginners, however, would be better served by picking up a separate book if they want to learn the concepts involved.
The final chapter of the book, “The World of Perl”, consists of a nearly schizophrenic series of snapshots of advanced applications of Perl. Like the two chapters above, this is a concentrated source of raw information for advanced users. If you’re a beginner, don’t expect to learn how to program graphical user interfaces or cryptographic security systems using only the bits and pieces presented here.
In brief, this book is a great way to learn the Perl language. Not only does its informal and entertaining style provide an inviting experience for readers new to programming, but the meticulous care that the author takes to point out key differences between Perl and other popular languages makes this an excellent introduction for skilled programmers as well. It’s important, however, that when reading this book you don’t set your expectations too high. Most real-world applications of Perl are beyond the scope of this book, and will require a little more research on the reader’s part.
Rating: 5/5
![Kevin Yank](https://uploads.sitepoint.com/wp-content/uploads/2015/04/1429112558kevinyank-96x96.jpg)
Kevin Yank is an accomplished web developer, speaker, trainer and author of Build Your Own Database Driven Website Using PHP & MySQL and Co-Author of Simply JavaScript and Everything You Know About CSS is Wrong! Kevin loves to share his wealth of knowledge and it didn't stop at books, he's also the course instructor to 3 online courses in web development. Currently Kevin is the Director of Front End Engineering at Culture Amp.