Teaches the basics of programming right along with the particulars of Perl syntax as well as good style and structure and maintainability of the code.
Perl strives to be both a natural language like English and a structured language like C, but Johnson evidently does not see the value in writing a prescriptive book as the other "Elements of" authors have. Rather, he has written a review of basic Perl for the converted and initiated. But just as an inexperienced carver cannot learn good carving practice with neither a Swiss Army knife nor a chain saw, a neophyte coder cannot learn good programming with a tool that has been called the "Swiss army chain saw" of programming languages. Can anyone learn good programming style from Perl at all? Better we should learn style elsewhere and bring what we already know to the notoriously laissez-faire language.
Perl was developed by linguistic enthusiasts to model a natural language, viz., an idiom consisting of a redundant vocabulary, syntax, and grammar with flexible rules, learnable by example or trial and error. Awk programmers can convert awk scripts to Perl with a utility, then learn Perl by fathoming the output. But where is the centrality of cold, inflexible logic in the design of supportable code? The essential tension in Perl for programming beginners lies between the natural language aspects of Perl (redundancy and flexibility) and the crucial need for discipline in writing programs.
Johnson draws his hoe into this fertile terrain but ends up plowing old ground. He adopts a didactic voice and follows a predictable pedagogical path from programming illiteracy through technical proficiency. He introduces task groups--processing text, lists, input/output, modules, debugging--and stops at introductions to modules and object-oriented code.
The book is studded with examples, exercises, tips, and tricks gleaned from years of "speaking Perl," but it avoids being prescriptive, and his casual advice is sometimes disconcerting. He discusses white space in formatting code, but he breezes past error handling. He teaches recursion without warning that it is a support nightmare. Often he hides behind Perl's creed that "there is more than one way to do it" to avoid advocating what the newbies need: one better-than-average way to do it. Johnson cannot be both advocate of Perl and teacher of beginning programming, though he has tried: had his experiment been bolder, it would deserve wider attention within the Perl and computer science communities. --Peter Leopold
Here's a couple of extracts: "Programming is about solving problems...Computers are mindless devices capable only of doing what they are told...When a method for solving a problem is reduced to a series of simple, repeatable instructions, we call that set of instructions an algorithm."
"...scalar variable, meaning it can only hold a single value."
"If you think of a variable as a storage bin with a name and an address, then you can think of a reference as a forwarding address. When you store a reference to another variable in a scalar variable, you are not storing that variable's value, but the address where its value is stored."
I bought this book after reading many reviews on it both good and bad. It was the bad reviews that told me this was the perfect book for a beginner. I like to think of myself as a person who likes to understand why I do things rather than just doing something because thats how it has always been done. This book did that for me.
Precise explanations of Perl style, syntax and regular expressions more experienced programmers take for granted were a welcome sight. Even though there isn't really a right or wrong way in perl this book teaches you the right way to do things along with the full explanations I required to understand why I was doing something one way and not the other.
The exercises following the chapters are challenging but not daunting. They allow you to use the knowledge you've learned in the previous chapters, even if at first it seems impossible, but to quote the author, "Programming is a matter of practice."
I recommend this to all who are new to programming in general and wish to make Perl their first language. Now all I need is a book on C programming that does the same this one is doing for me.
Yes, I have not read this book completely, yet I have done 3 useful scripts for work and I'm amazing myself. Perl is making my life and my co-workers' much easier.