Book Review: Perl One Liners

This is a review of a new book by Peteris Krumins, Perl One Liners, 978-1-59327-520-4 is where you can get an ebook and review books yourself.
Hurry down to Appendix C, where perl1line.txt is, and shows every one-liner in the
book. Larry probably only needs Appendix C. The rest of us can enjoy the book.
Ever heard of strawberry perl? Or the nuances of PowerShell? There is stuff that
you don’t know in here.

This book can be read very quickly by experienced perl programmers who know about $_ and
hashes and lists and single quotes and backslashes. Less experienced users can
probably use it to get work done fast. Non-programmers and aspiring not-yet-programmers
can probably learn very efficiently using this book. Many of these one-liners are
outright programs that could run to dozens or hundreds of lines of code. The
density can reveal many problems being addressed on one line, including: open file, read line,
process line, do some other stuff, save file. All on one line! Seriously, folks,
CompSci 101 courses might be more fun with a book like this (instead of the standard
C++ tome).

I love Perl. I have long ago moved on to other languages that all the kids prefer.
I don’t buy new perl books because I don’t use perl as often and I’m already proficient
enough to follow the standard procedure for solving a problem with perl:

1. Write down problem.
2. Discover which module to use to solve problem.
3. Read API basics to learn how to use the module.
4. Install module via CPAN.
5. Write program.
6. Go home.

Nowadays, I find myself using python in a similar way. I notice that Perl One Liners
does not avoid using the modules (with -M).

One problem that has been annoying me is migrating data into SQLite. There is not a
reliable program to change a mysql dump into an sqlite database. For some reason,
this problem always seems to require manual intervention. I find myself with 200 character
command lines involving sed and tr. Then I use that output to run through a python
script. Eventually I end up with the SQLite database that I wanted several hours ago.
That isn’t so bad, but when I try to recall how I went from the source data to the
SQLite database, its too tedious to remember or explain. When I saw the new book by
Peteris Krumins, Perl One Liners, 978-1-59327-520-4, I thought to myself that perl
would probably work better than sed sed sed tr sed sed tr sed sort uniq python sed.

I never use Perl on the command line. I remember Tom Christiansen (or Larry?) once
said that you could use Perl as your shell, if you’re crazy. I hope I’m not crazy and
I don’t use perl as my shell. But I have been using it on the command line alot
this week with good results. Using perl one-liners to stuff HTML or mysqldump sql
into an SQLite database hasn’t made things any better. But I probably just don’t yet
have the right line. Thanks Peter! Nice book.



About smoothtommy

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s