Customer Review

8 of 10 people found the following review helpful
3.0 out of 5 stars Interesting (if flawed) guide to an under-used Perl feature, December 19, 2013
This review is from: Perl One-Liners: 130 Programs That Get Things Done (Kindle Edition)
Perl one-liners are an important part of its power and flexibility. The ability to process a file quickly without having to write a program is often really useful. Any Perl programmers should take the time to get to know the command like switches that make this possible. This book is a pretty good introduction to this way of using Perl.

So why only three stars? Well, I have a couple of reservations about the book. Firstly, there are a few technical errors which the editors should have caught. For example, a few times the author refers to "array context" where he means "list context". The difference between arrays and lists is often difficult for beginners to master and it doesn't help when books blur the distinction.

My other reservation is with the programs themselves. The book boasts "130 programs that get things done". But I think they have had to stretch things a bit to get to that number. One program might be "print lines that match a pattern". Then the next program will be "print lines that don't match a pattern". I'm not sure that inverting the logic in a one-liner is enough of a difference to justify counting it separately. Sometimes you'll come across two or three pages of examples all of which are only tiny permutations of each other.

But it's good to see publishers bringing out books on Perl. And this is certainly an area of Perl that hasn't received much coverage before. I just think it's a rather thin concept to spin out to a book. Even this stretched, it's a rather thin book (140 pages - 50 of which are appendices). It might have been better as a cheap Kindle-only publication.
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No

[Add comment]
Post a comment
To insert a product link use the format: [[ASIN:ASIN product-title]] (What's this?)
Amazon will display this name with all your submissions, including reviews and discussion posts. (Learn more)
Name:
Badge:
This badge will be assigned to you and will appear along with your name.
There was an error. Please try again.
Please see the full guidelines here.

Official Comment

As a representative of this product you can post one Official Comment on this review. It will appear immediately below the review wherever it is displayed.   Learn more
The following name and badge will be shown with this comment:
 (edit name)
After clicking the Post button you will be asked to create your public name, which will be shown with all your contributions.

Is this your product?

If you are the author, artist, manufacturer or an official representative of this product, you can post an Official Comment on this review. It will appear immediately below the review wherever it is displayed.  Learn more
Otherwise, you can still post a regular comment on this review.

Is this your product?

If you are the author, artist, manufacturer or an official representative of this product, you can post an Official Comment on this review. It will appear immediately below the review wherever it is displayed.   Learn more
 
System timed out

We were unable to verify whether you represent the product. Please try again later, or retry now. Otherwise you can post a regular comment.

Since you previously posted an Official Comment, this comment will appear in the comment section below. You also have the option to edit your Official Comment.   Learn more
The maximum number of Official Comments have been posted. This comment will appear in the comment section below.   Learn more
Prompts for sign-in
 

Comments

Tracked by 2 customers

Sort: Oldest first | Newest first
Showing 1-3 of 3 posts in this discussion
Initial post: Dec 20, 2013 4:12:50 AM PST
Thanks for the review David!

My apologies for writing "array context" on page 40 in the book. I scanned through the book and it was the only place I had mistakenly written so. It should say "list context" there like this:

"In the _list context_, both gmtime and localtime return a nine-element list"

I just let my publisher know and the Kindle and ebook versions will have this inaccuracy fixed, and this update will be posted on the book's website at nostarch.com/perloneliners.

David, it would be great if you could let me know other inaccuracies that you found (email me peter@catonmat.net).

If any of the book readers have trouble understanding arrays and lists (or anything else) email me peter@catonmat.net at any time and I'll help you understand the difference!

I personally love the style of making small incremental changes to show how you can easily change one-liners to do more or less things. I also like showing the readers how to do the same thing in many different ways following the "there's more than one way to do it" Perl's mantra. I also enjoy showing the readers how to golf Perl programs (writing a very short version of the same program). That's why I sometimes spend a page or two writing examples which are tiny permutations of each other.

There's a really interesting reason why some of the programs are just the inverse of the other like you mentioned. If you google "awk1line.txt" and "sed1line.txt", you'll find two very interesting files full of awk and sed one liners, which I found very entertaining to work through when I was learning awk and sed. I followed the structure of this file closely when I wrote Perl one liners (and "perl1line.txt" file). That is why some programs are just inverses of each other!

I haven't really counted how many programs total there are in the book, but probably well over 200. There are 130 one-liners in the table of contents, but that doesn't include many different one-liners that appear in introduction, appendix A, and the many permutations and golfed examples.

Posted on Mar 20, 2014 12:03:03 AM PDT
BruceK says:
Nice review. My question about the book, which I'm assuming you answered in the affirmative is - is the whole book PERL command line "programs?"

I got to here looking for the book "Perl Phrasebook" which I thought might have some good useful example codes in PERL, but that book appears to be out of print, and also not on Kindle.

I've used PERL quite a lot, but for some reason I just cannot become fluent or comfortable with it and I am looking for a book to give me a repertoire of useful chunks PERL I can remember.

In reply to an earlier post on Mar 20, 2014 12:11:13 AM PDT
David Cross says:
Bruce, yes, this book is all command line programs.

For what you want, you could take a look at "Effective Perl Programming". I'd recommend "The Perl Cookbook", but the Perl it uses looks a little dated now.

Oh, and it's "Perl", not "PERL" :-)
‹ Previous 1 Next ›

Review Details

Item

4.3 out of 5 stars (10 customer reviews)
5 star:
 (4)
4 star:
 (5)
3 star:
 (1)
2 star:    (0)
1 star:    (0)
 
 
 
$9.99
Add to wishlist
Reviewer


Location: London, UK

Top Reviewer Ranking: 2,108,315