Perl One-Liners
130 Programs That Get Things Done
Publisher: No Starch Press
Final Release Date: November 2013
Pages: 168

Part of the fun of programming in Perl lies in tackling tedious tasks with short, efficient, and reusable code. Often, the perfect tool is the one-liner, a small but powerful program that fits in one line of code and does one thing really well.

In Perl One-Liners, author and impatient hacker Peteris Krumins takes you through more than 100 compelling one-liners that do all sorts of handy things, such as manipulate line spacing, tally column values in a table, and get a list of users on a system. This cookbook of useful, customizable, and fun scripts will even help hone your Perl coding skills, as Krumins dissects the code to give you a deeper understanding of the language.

You'll find one-liners that:

  • Encode, decode, and convert strings
  • Generate random passwords
  • Calculate sums, factorials, and the mathematical constants π and e
  • Add or remove spaces
  • Number lines in a file
  • Print lines that match a specific pattern
  • Check to see if a number is prime with a regular expression
  • Convert IP address to decimal form
  • Replace one string with another
And many more! Save time and sharpen you coding skills as you learn to conquer those pesky tasks in a few precisely placed keystrokes with Perl One-Liners.
Table of Contents
Product Details
About the Author
Recommended for You
Customer Reviews

REVIEW SNAPSHOT®

by PowerReviews
oreillyPerl One-Liners
 
4.2

(based on 5 reviews)

Ratings Distribution

  • 5 Stars

     

    (2)

  • 4 Stars

     

    (2)

  • 3 Stars

     

    (1)

  • 2 Stars

     

    (0)

  • 1 Stars

     

    (0)

100%

of respondents would recommend this to a friend.

Pros

  • Accurate (5)
  • Helpful examples (4)
  • Well-written (4)
  • Easy to understand (3)

Cons

No Cons

Best Uses

  • Intermediate (5)
  • Novice (4)
    • Reviewer Profile:
    • Sys admin (5), Designer (3), Developer (3)

Reviewed by 5 customers

Displaying reviews 1-5

Back to top

(0 of 1 customers found this review helpful)

 
5.0

Another useful tool for my kit.

By Thogscave

from Troy, NY

About Me Sys Admin

Verified Buyer

Pros

  • Accurate
  • Concise
  • Easy to understand
  • Helpful examples
  • Well-written

Cons

    Best Uses

    • Expert
    • Intermediate
    • Novice

    Comments about oreilly Perl One-Liners:

    Much in the spirit of the classic " Unix Power Tools", this book provides simple solutions to real-world problems. Sure, I could just google for the answer I need, but there's no substitute for thumbing through a book and gaining new insights as you go.

    Thus book is a worthwhile addition to my "bag of tricks", and I recommend it to anyone who likes simple, well-crafted solutions with useful explanations.

    (0 of 1 customers found this review helpful)

     
    3.0

    Needs more editing.

    By Keith

    from Utah

    About Me Designer, Developer, Educator, Maker, Sys Admin

    Verified Buyer

    Pros

    • Accurate
    • Good Code Explanations

    Cons

    • Code Examples Not Complet

    Best Uses

    • Expert
    • Intermediate
    • Novice

    Comments about oreilly Perl One-Liners:

    There are a lot of good things in this book, but I had a couple of issues that frustrated me.

    First, and least important, the writing of the book rambles a little. The writings needs tightened up and made more concise.

    More importantly, the "one liners" are not all one line. I don't have a problem with them being more than one line, but I do have a problem with code examples being forced into one line to justify it being in the book. A line of code will be presented and explained, and then the reader is told to put it in a loop. Just show me all the code together so I don't have to piece it together with trial and error.

    Another complaint is when a command is shown, but no explanation of where the data is coming from or going to. For example, this code from page 37 does nothing, no data is being passed to it: Perl -pe '$_ = "$. $_"'
    This code more useful: Perl -pe '$_ = "$. $_"' somefile.txt
    This code sends the output to a new file: Perl -pe '$_ = "$. $_"' somefile.txt > newfile.txt

    I needed to see more fleshed out examples. I'm reading this book because I want to learn Perl, I lack the expertise to fill in the missing details.

    I keep the book handy and browser through it when I have a couple minutes of free time. The explanation of each "trick" is interesting and helpful.

     
    5.0

    Book which save the time

    By Radim Krcmar

    from Prague, Czech republic

    About Me Designer, Developer, Sys Admin

    Verified Buyer

    Pros

    • Accurate
    • Easy to understand
    • Helpful examples
    • Well-written

    Cons

      Best Uses

      • Intermediate

      Comments about oreilly Perl One-Liners:

      It is greak book for me which I can use in real world. I work as database administrator, data integration developer etc. So this books which are small and accurate are for me very important.

       
      4.0

      Good reference

      By Jean-Francois

      from Ottawa, CANADA

      About Me Sys Admin

      Verified Buyer

      Pros

      • Accurate
      • Helpful examples
      • Well-written

      Cons

        Best Uses

        • Intermediate
        • Novice

        Comments about oreilly Perl One-Liners:

        I like the way it is presented. The only reason for a four-star is that I would have used evenmore of those one-liners. But htose in the book asre very useful. Being divided by groups also helps in crafting your own, based on specific needs.

        (3 of 3 customers found this review helpful)

         
        4.0

        Almost 5/5

        By teak

        from Jyväskylä, Finland

        About Me Designer, Developer, Educator, Maker, Sys Admin

        Verified Reviewer

        Pros

        • Accurate
        • Concise
        • Easy to understand
        • Helpful examples
        • Well-written

        Cons

          Best Uses

          • Intermediate
          • Novice
          • Student

          Comments about oreilly Perl One-Liners:

          This book is among one of the most useful ones. The title and the description describe the book perfectly. It is all about one-liners doing simple things fast and efficiently.
          Each presented one-liner (more than 100) is explained thoroughly. This makes it easy to modify them for your own use (been there, done that). Text flow was good, the examples stood out from rest of the text.
          The table of content was excellent, practically listing all one-liners in topical order. Unfortunately this ToC wasn't made into PDF-ToC, it was just pages in a pdf-document, this devalues it when read on mobile devices.
          You find an example chapter from no starch press website.

          Everything else except lack of PDF ToC screams 5/5 but I just can't give full score with good conscience as a reviewer due to this minor detail.

          So it has to be 4/5 with a praise of excellent book and I do recommend this book to all and any Perl users.

          ps. I received this book through O'Reilly blogger review program.

          Displaying reviews 1-5

          Back to top

           
          Buy 2 Get 1 Free Free Shipping Guarantee
          Buying Options
          Immediate Access - Go Digital what's this?
          Ebook:  $19.95
          Formats:  ePub, Mobi, PDF
          Print & Ebook:  $27.45
          Print:  $24.95