Submission + - Minimal Perl for Unix and Linux People
The book titled "Minimal Perl — for Unix and Linux people", authored by Tim Maher and published by Manning Publications addresses these obstacles presented by Perl's complexity. This book which is divided into two parts comprising of a total of 12 chapters takes a unique methodology to explain the Perl syntax and its use. The author emphasizes on Perl's grep, awk and sed like features and relys on concepts such as inputs, filters and arguments to allow Unix users to directly apply their existing knowledge to the task of learning Perl.
What I found while reading this book is that the "Minimal Perl" is a specially crafted subset of Perl language designed to be easily grasped by people who have a Unix background and who wish to use Perl to write their scripts. Its main aim is to filter out the complex way of writing programs using Perl and stick to simple ways and where ever possible accomplish complex tasks using just one or two lines of Perl code. So in the first part of the book comprising of 6 chapters, the author explains how Perl can be used to do the same tasks as accomplished by common Unix tools such as grep, awk, sed and find. He goes one step further by explaining how one can accomplish much more and in a much simpler way by using the Perl techniques than can be achieved by using these tools.
Through out the book, the author consciously makes sure that the learning curve in acquiring Perl skills remain gentle. As Perl is a language whose syntax has a multitude of options, this book is peppered with numerous tables which provide excellent information at a glance. For example, in the third chapter titled "Perl as a (Better) grep command", the author lists and compares the fundamental capabilities of Perl and the different grep commands such as grep, egrep and fgrep which clearly shows the advantages that Perl has over grep. In another table, you get a birds eye view of the essential syntax of Perl's regular expressions and their meaning. This chapter alone has around 12 tables. This is a really nice feature of this book because it doubles this book as a ready reference for Perl where you can flip to the respective page and get the information you need.
The main strength and drawback of a language such as Perl is its dependence on regular expressions for accomplishing complex tasks. Once you master the regular expressions, the sky is the limit for ordering and segregating data using this language. And in Perl, there are more than one ways of doing the same thing. What is unique about this book is that the author specializes in explaining the easiest way of doing a particular task as is hinted by the title of the book.
In many places, the author demonstrates accomplishing complex tasks using just a few lines of Perl code. And many of the examples covered in this book are practical examples which give an idea of how the commands relate to the final outcome. For instance, while elaborating on the one line grep like commands in Perl, the author illustrates a web oriented application of pattern matching where he shows how to extract and list, the outline of slashdot.org site's front page. And the surprising thing is this is accomplished using just a single line of Perl code. This book has lots of such one liner examples which teaches how to use Perl intelligently using minimal effort.
If part I of this book focuses on ways in which simple Perl programs can provide superior alternatives to standard Unix commands, the second part comprising of another six chapters throws light on the other aspects of Perl concentrating on the syntax of the language and various built-in functions and modules available which does away with a lot of re-invention of the wheel — so to speak, and helps churn out code which is portable across OSes.
Chapter 7 titled "Built-in functions" introduces an eclectic mix of functions available in Perl. So you have functions which are used to extract a list of fields from a string, functions to access the current date and time, generating random numbers, sorting lists, transforming lists, managing files with functions and so on. These functions are broadly classified into those which generate and process scalars and those that process lists.
In chapter 8 of this book, the author involves the reader on the numerous scripting techniques that can be used to write better Perl programs.
It was quite surprising that the author has chosen to discuss the variables — more specifically the list variables comprising of arrays and hashes as well as the looping constructs only in the 9th and 10th chapters respectively when they should be some where up front. But on hind sight, I feel it is a good decision as once, you execute the one liner Perl programs in the initial chapters, by the time you reach the 9th chapter, you will be fairly confident in using Perl.
The last two chapters deal with creating sub-routines and modules. Over the years various Perl programmers have created modules which are used for diverse purposes. And with an aim to share these modules, they are collected and stored at one central place known as CPAN, which is an acronym for Comprehensive Perl Archive Network. The final chapter, apart from teaching how to create modules in Perl and manage them, also introduces the CPAN and ways in which one can find the right module by searching on CPAN.
The special variables cheat-sheet and the guidelines for parenthesizing code provided in the two appendices are really useful as a quick reference while writing Perl programs.
This is not a comprehensive book on Perl, rather the author specializes on a slice of Perl which when mastered can do over 95% of the jobs which require Perl. So for instance, you won't find object oriented concepts of Perl being mentioned in this book. But in many ways, the author has moved beyond explaining a subset of Perl by providing a section titled "Directions for further study" at the end of each chapter, where the author lists further material which can be used to learn more about the topic that is covered.
I really enjoyed going through this book on Perl, especially because it stresses on the practical side of using Perl and takes a minimal approach which does away with some of the seemingly complex nature of this language.
Ravi Kumar maintains a blog titled "All about Linux" where he shares his thoughts and experiences in using Linux, Open Source and Free software."