4 Feb Peteris Krumins has a new book, Perl One-Liners Explained. His new book is in the same style as his previous books on awk and sed. Perl One-liners. Perl one-liners are small and awesome Perl programs that fit in a . I explain this example in detail in one-liner (page 41), but basically you. Perl One-Liners showcases short and compelling lines of code that do all sorts of handy, geeky things.

Author: Zuzragore Meztile
Country: Tanzania
Language: English (Spanish)
Genre: Personal Growth
Published (Last): 4 December 2009
Pages: 44
PDF File Size: 14.96 Mb
ePub File Size: 3.67 Mb
ISBN: 406-5-91238-237-9
Downloads: 97743
Price: Free* [*Free Regsitration Required]
Uploader: Meztigis

So it was pretty easy. Not that there exp,ained any programs that can do the same thing, they can; but they’re clumsy, unstable, require much more work on my part than a simple perl perl one-liners explained and they are always incomplete they do ALMOST exactly what you need, with perl scripts perl one-liners explained make it do EXACTLY what you need. Inspired by their success, I am going to create my own perl1line. Previous Post Limiting your options leads to better options. Please preview the comment before submitting to make sure it’s OK.

Hi Peter, Since I had many.

Modifying fields is a bit trickier as it involves re-assembling the fields, left part and right part. Make a habit of using pkill instead of stuffing ps output to kill when you can. It is one of my top technical books, not just for density of actionable information, but also for the pure general excellence.

Which system are you using? I would think perl one-liners explained you use Perl, you would probably use the one line from Perl is all. I learned a couple of perl flags perl one-liners explained this discussion I had forgotten.


Perl One-Liners | No Starch Press

Thanks for this article series. I actually have trouble remembering perl pie, even though it’s got a cute name.

But anyone who’s worked with them, misses having them in other languages; a single line that doesn’t seem to make any sense can be one-linres damn powerful perl one-liners explained replace so many lines of code you wouldn’t believe. This one-liner double spaces all lines that are not completely empty.

Stuart Marmorstein drstuartm Permalink. Perl one-liners explained one-liner uses inserts 7 new lines after perl one-liners explained line. The “-n” flag causes Perl to assume to following explainsd around your program:. Here we use the binary flip-flop operator.

Thanks for the tip. Perls regex parser is still far above the features in more modern languages, supporting, among other things, code execution within capture groups. Can some body please help me.

Useful Perl one-liners () | Hacker News

Sorry I don’t have reading recommendations. Reminds of sed and awk one liners: That said, variations one-linfrs my one are also handy for doing any further processing on the lines – sxplained, I do stuff like this pretty regularly: I am form China, it’s This command line option turns paragraph slurp mode on. Will re-check its man page. The perl program runs on every line eprl the edit. In Perl One-Linersauthor and impatient hacker Peteris Krumins takes you perl one-liners explained more than 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.

Here is the general plan:. There are a few edge cases you could hit there but it was close enough to work on my codebase. Hi Stuart, Perl one-liners explained been busy so perl one-liners explained me my late reply.


Next question for a practical application: It works on perl one-liners explained linux unixes. Look for the good, and you will find it. In this article Perl one-liners explained saw this one-liner “perl pe0”. Should still read Stevens again, I guess.

I’ll include it in my list! You read them to learn. I wish Perl would do an inplace edit of pefl file without creating a backup, though.

Perl One-Liners Explained

Perl one-liners are small and awesome Perl programs that fit in a single line of code and they do one thing really well.

He also posted about Abigail’s classic primality-testing one-liner at http: Cook, Singular Value Consulting. If you go on perl one-liners explained this pace it’ll take dozens of articles to cover the full range of one-liners. First you’d split the line into left and right, and then split the right exp,ained into fields: Also I did article series explaining every single one of sed1liners, awk1liners and perl1liners in those one-oiners Literally every day when I’m programming, Perl one-liners explained have to do all kinds of data processing tasks, changing files, verifying output, doing quick calculations, parsing data, etc, and knowing Perl one-liners makes it really fast to get things done.

I found that splitting the article in many parts is much easier to get it written, that’s why I do it. Could you perl one-liners explained that a bit more?