Trusted SF Member
Joined: 26 Aug 2003
Location: Warwickshire, England, UK
|Posted: Mon Oct 31, 2005 1:55 am Post subject: Book Review - Learning Perl, 4th Edition
Learning Perl, 4th Edition
Author(s): Randal L. Schwartz, Tom Phoenix, brian d foy
Publisher: O'Reilly http://www.oreilly.com
Date Published: July 2005
Book Specifications: Softcover, 283 pages
Publisher's Suggested User Level: Not Rated
Reviewer's Recommended User Level: Beginning Perl Programmers
Suggested Publisher Price: $39.95 US / $55.95 CDN
Blurb from back cover:
Learning Perl, better known as “the Llama book,” startes the programmer on the way to mastery. Written by prominent members of the Perl community who each have several years of experience teaching Perl around the world, this latest edition has been updated to account for all the recent changes in the language up to Perl 5.8.
Perl is the language for people who want to get work done. It started as a tool for Unix system administrators who needed something powerful for small tasks. Since then, Perl has blossomed into a fully featured programming languageused for web programming, database manipulation, XML processing, and system administration – on practically all platforms – while remaining the favourite tool for the small daily tasks for which it was designed. You might start using Perl because you need it, but you'll continue to use it because you love it.
Informed by their years of success in teaching Perl as consultants, the authors have reengineered the Llama book to better match the pace and scope appropriate for readers getting started with Perl, while retaining the detailed discussions, thorough examples, and eclectic wit for which the Llama is famous.
Perl is a flexible, powerful language. The caption at the top of the book cover says “Making easy things easy & hard things possible”, and Perl does indeed excel at this.
Unfortunately, Perl is quite an ugly language; it is terse and there are rules, exceptions to the rules, and exceptions to the exceptions to the rules. It can use default values if no variable name is present, and some operators work on standard input if nothing else is specified. As a result, Perl is not an easy language to learn – you have to understand all of these complexities before you can write programs over about 20 lines long.
The problem, then, is to teach Perl in a way which explains the pitfalls as you go, whilst motivating and challenging the learner. Learning Perl does just this.
Now in its fourth edition, Learning Perl is a classic first book for Perl programmers. It is nicknamed “the Llama” by its dedicated fanbase, due to the Llama image on the book cover, and almost every Perl programmer you speak to learned Perl from this book.
Chapter Synopsis & Review Comments
Chapter 1 introduces Perl, explaining where Perl can be obtained from and how Perl programs are written.
Chapter 2 moves on to discuss Perl's scalar data types, along with some control structures such as the if and while constructs.
Lists and arrays are the topic of chapter 3, which explains the differences between a list and an array (and, indeed, the similarities) and introduces the reader to Perl's support for these data types.
Chapter 4 deals with Perl subroutines. It looks at defining subroutines, passing arguments, returning values, variables within a subroutine, variable-length parameter lists and much more.
The essential topics of input and output are covered in chapter 5. Standard Input, the diamond operator, formatted output, and file I/O are covered here.
Chapter 6 looks at hashes (also called associative arrays, maps, or dictionaries, in other languages). These data structures link one set of data (the keys) to another (the values) and are useful in manipulating related data sets.
Regular expressions are given a thorough treatment in chapters 7, 8 and 9. Chapter 7 introduces Perl Regular Expressions, pattern matching facilities for parsing data, while chapter 8 looks specifically at matching. Text processing is covered in chapter 9.
Control structures are the topic of chapter 10, which looks at the unless construct, along with until, elsif, for and looping.
Chapter 11 looks at file tests, including the stat function which returns data about the size, type, and permissions associated with a file, while chapter 12 covers directory operations such as traversing a directory tree, globbing (a process of specifying multiple files from a directory), and manipulating directories themselves.
Strings are discussed in chapter 13, which looks at substrings, indices, string manipulation, the sprintf formatting construct and string sorting.
Chapter 14 covers process management, looking at the system and exec functions, which can be used to launch other programs from within a Perl program. Capturing program output, managing environment variables and using processes as file handles are covered, and the chapter is rounded off with a discussion of the fork function and signal handling.
Chapter 15 moves back into the depths of Perl, looking at modules. Perl has a huge quantity of included modules, as well as countless third-party modules providing extensions to achieve just about everything anyone has already ever tried to do. This chapter looks at finding and installing some of these modules.
Chapter 16 covers advanced Perl techniques, error trapping, transforming list items and slicing, a topic best left for the book to explain!
The book ends with an appendix containing answers to the exercise questions presented at the end of each chapter, and an appendix detailing resources the reader can use to be taken further into Perl, having completed “the Llama”.
Style and Detail
Learning Perl is fast-paced, but does not leave the reader behind. Every concept is explained fully either in the main text, or in the footnotes (of which there are very many – in fact, some of the footnotes have footnotes of their own!).
The authors senses of humour are clearly visible in the text of the book, and an amusing, light-hearted read is assured. The most difficult parts of Perl are presented in a manner which allows the reader to absorb the urgently relevant, and return later for the minutiae.
Each chapter ends with a selection of exercises carefully chosen to provide the reader with a challenging, yet interesting way to utilise the knowledge they have gained from the chapter, and to piece it together with the previous chapters. The appendix providing solutions to these exercises further emphasises the books helpful approach, as it is possible to refer to the full (or partial) solution should the reader run into problems with any exercise they are attempting.
This book is held in high esteem amongst Perl programmers, and any new edition must retain the essence of the previous editions to maintain its position at the top. The fourth edition does just that, and perhaps even exceeds the expectations from the third edition, providing updated information regarding the latest evolution of the Perl language.
This book was written to teach Perl, and as the authors get more experience teaching Perl, the book has improved with each edition. This trend has continued to the fourth edition, which receives the highest possible review rating.
This book receives an honoured SFDC Rating of 10/10.
Keywords: Perl, Learning, programming, regular expression, llama
This review is copyright 2005 by the author, Andrew J. Bennieston, and Security-Forums Dot Com, and may not be reproduced in any form in any media without the express permission of the author, or Security-Forums Dot Com.