News for hackers. Stuff that matters.
Re:Perl One-Liners by kamaal on Wednesday December 04, 2013 @10:16PM (#6852478)
Not sure, how many of you are aware. But this exists from the era of the bygones and the site is still active. Go take a look at http://www.perlmonks.org/ The whole site is a treasure, an extremely precious treasure of programming wealth. I've learned more from Perl Monks than from any book out there.

Some day that database will super valuable. It still is. Sometimes I get this idea that once could crawl that site, extract all the useful information and convert it into a neat book.

All the best, and Happy writing Perl one-liners, its an art of converting days worth work into a few seconds. I haven't read this book, but it definitely must be awesome. As with anything with Perl, it always is.

Before all this big data fad caught on, I used to write Perl one liners to solve most problems in 10% the time and probably 1% of the resources, for nearly most cases of what people call big data today.

Re:Perl One-Liners by csmuk on Thursday December 05, 2013 @05:02AM (#6853539)
As I found many times, Perl is awesome until you encounter someone else's Perl.

I inherited a Perl CGI and MySQL monster back in 2002 from a Perl monk who unfortunately died. It was a horrific Cthulu-inspired sprawling demon from hell. Little did I know, this is the norm until my third wave of inherited Perl a few years later.

Larger things now push me to Python and I get enough mileage on the smaller things out of the shell and sed/grep/awk. If I want fast stuff, it's a speedup module for Python in C.

I think back fondly of it but I know at the same time it hurt me.

Re:Perl One-Liners by fuzzix on Thursday December 05, 2013 @05:32AM (#6853654)
> "As I found many times, Perl is awesome until you encounter someone else's Perl."

I was once that "someone else" - I once left a many-thousand line script behind me which consisted of hundreds of undocumented (and very similar in many cases) regexes and not one instance of the word 'sub'. "It just sort of grew like that", "I was young, a novice!" I tell myself, but still jerk awake in a cold sweat from time to time after fevered dreams of 30 levels of conditional nesting.

My last gig where I took over for "someone else", a fairly new system which still managed to have "legacy issues", I understood the gravity of my crime. I tried to atone by crafting concise, readable nuggets for my successor but I am still haunted.

I met the chap who took over from me recently. Regarding my "someone else" he asked: "How did you maintain your sanity?" "I didn't". He also complimented the parts I left behind, but I still have those restless nights.

"Someone else"'s worst crimes were committed using Ruby on Rails, but the Perl system was constrained by an existing, strongly defined framework. With absolute freedom, there's no telling what damage "someone else" may have wrought.

Re:Perl One-Liners by mst on Thursday December 05, 2013 @05:18PM (#6857754)
Oddly, the most horrific Cthulu-inspired sprawling demon from hell I've ever inherited was actually written in python.

I guess a sufficient level of disinterest in maintainability can defeat any language designer's hopes for the future.

Re:Perl One-Liners by pachydermic on Thursday December 05, 2013 @12:40AM (#6852880)
perlmonks is definitely the thing which most impressed me about perl. Very helpful, kind, patient and incredibly knowledgeable people there. I don't really have anything useful to say, I just want to thank anyone that's been a part of that community - they've certainly helped me out immensely.
Re:Perl One-Liners by pkrumins on Wednesday December 04, 2013 @06:14PM (#6851208)
Hey guys,

I'm happy to give free review copies to first 10 people who'd really like to read the book! (Print books+ebooks within the US, ebooks anywhere else.) Just respond to this comment and I'll send you a free review copy!

Alternatively use coupon code HNPERL for 40% off (till Dec 16).

UPDATE: All 10 copies have been claimed. Thanks everyone who participated in the giveaway!

Re:Perl One-Liners by dmunoz on Wednesday December 04, 2013 @06:28PM (#6851325)
Would love to review your book. Where are you looking for reviews to be submitted? I'm outside the US, so it would only need to be an ebook.

Just about to talk the dog out for a walk, but will check in as soon as I return. Thanks for the opportunity.

Re:Perl One-Liners by pkrumins on Wednesday December 04, 2013 @06:29PM (#6851337)
Awesome, you got a review copy. You can submit the review on your blog, or just tweet about it, or if you don't feel like saying anything about it, then it's fine too. Email me [email protected] and I'll arrange you a copy!
Re:Perl One-Liners by dragonfax on Wednesday December 04, 2013 @06:49PM (#6851477)
I used to be a Perl Guru, but am well out of practice. I still use it in my regular job as a pragmatic way to do some data munging without having to start up a REPL.

I'd love to have a copy of the book.

Re:Perl One-Liners by pkrumins on Wednesday December 04, 2013 @06:52PM (#6851498)
Great! Email me [email protected] and I'll send you a copy. Once you read through it, you'll be much faster with that data mungling!
Re:Perl One-Liners by throwaway344 on Wednesday December 04, 2013 @06:29PM (#6851340)
Yeah, I would love to see the book. Perl is a language I've always wanted to explore further. You can contact me at the email in my profile.
Re:Perl One-Liners by pkrumins on Wednesday December 04, 2013 @06:31PM (#6851361)
Perl is awesome. And I teach it really fun way in this book. I'll contact you. :)
Re:Perl One-Liners by co_pl_te on Wednesday December 04, 2013 @06:51PM (#6851492)
Would love to give this a review, if possible. More of a Ruby guy, but I really appreciate the elegance of a good one-liner.
Re:Perl One-Liners by pkrumins on Wednesday December 04, 2013 @06:56PM (#6851522)
Yup, you got the copy. You're the 9th person. Email me [email protected] with your details.

Talking about Ruby, take a look at this:

http://benoithamelin.tumblr.com/ruby1line

My friend Benoit Hamelin translated all Perl one-liners to Ruby a while ago!

Re:Perl One-Liners by co_pl_te on Wednesday December 04, 2013 @07:00PM (#6851548)
Thanks for the tip on the Ruby post. Will shoot you an email.
Re:Perl One-Liners by vikiomega9 on Wednesday December 04, 2013 @06:39PM (#6851403)
Would love to get a copy!
Re:Perl One-Liners by pkrumins on Wednesday December 04, 2013 @06:39PM (#6851408)
Cool! Email me [email protected] and you got it.
Re:Perl One-Liners by _xo_ on Wednesday December 04, 2013 @06:42PM (#6851430)
I would also like to read it very much :)
Re:Perl One-Liners by pkrumins on Wednesday December 04, 2013 @06:43PM (#6851436)
You got a copy! Email me [email protected]. :)
Re:Perl One-Liners by Aaronn on Wednesday December 04, 2013 @06:27PM (#6851312)
I would love to take a look at the book!
Re:Perl One-Liners by pkrumins on Wednesday December 04, 2013 @06:28PM (#6851323)
Cool, email me [email protected] with your shipping address and I'll get you a copy!
Re:Perl One-Liners by waeyn on Wednesday December 04, 2013 @06:53PM (#6851503)
I would thoroughly enjoy a review copy!
Re:Perl One-Liners by pkrumins on Wednesday December 04, 2013 @06:58PM (#6851534)
You're 10th. You got the last copy! Send me your mailing details to [email protected]. :)
Re:Perl One-Liners by makerman on Wednesday December 04, 2013 @06:35PM (#6851376)
I'd love to read the book!
Re:Perl One-Liners by pkrumins on Wednesday December 04, 2013 @06:38PM (#6851400)
Excellent! Email me at [email protected] and I'll send you a free copy!
Re:Perl One-Liners by vezzy-fnord on Wednesday December 04, 2013 @06:28PM (#6851331)
Yeah, I'd like to take a look, as well.
Re:Perl One-Liners by pkrumins on Wednesday December 04, 2013 @06:30PM (#6851344)
Great! Email me [email protected] your address and I'll send you a copy!
Re:Perl One-Liners by mst on Wednesday December 04, 2013 @10:07PM (#6852439)
I got to see a pre-release. I didn't write a review, as such, because I already knew everything that was in there and I can't really say if it teaches well as a result. But:

I read most of this book, and didn't want to yell at the authors because they were doing Perl wrong.

Given how much of a perfectionist bastard I am ... this is likely high praise.

Re:Perl One-Liners by pkrumins on Wednesday December 04, 2013 @10:28PM (#6852508)
10 years on #perl teaches you some good Perl. Thanks for the praise, Matt. I appreciate it.
Re:Perl One-Liners by systems on Thursday December 05, 2013 @04:33AM (#6853430)
So you didn't want to yell, because there was nothing bad enough to yell at

or because you were being ... inexplicably... kind?

Re:Perl One-Liners by mst on Thursday December 05, 2013 @05:17PM (#6857743)
There's no need to accuse me of that :)
Re:Perl One-Liners by hernan604 on Friday December 06, 2013 @09:51PM (#6865234)
hahahaha mst you bastard :p
Re:Perl One-Liners by MrZongle2 on Wednesday December 04, 2013 @06:59PM (#6851539)
"Your mama writes Perl code so bad she made Larry Wall switch to Python!"

Wrong type of Perl one-liner?

Re:Perl One-Liners by pkrumins on Wednesday December 04, 2013 @07:00PM (#6851545)
Haha, that's the best type of Perl one-liner! Just let's make it proper:

    perl -E 'say "Your mama writes Perl code so bad she made Larry Wall switch to Python!"'
Re:Perl One-Liners by retroafroman on Wednesday December 04, 2013 @06:16PM (#6851222)
Congratulations! I like to watch your blog[1] for interesting tidbits. I always pick up something I didn't know how to do.

[1] http://www.catonmat.net/

Re:Perl One-Liners by pkrumins on Wednesday December 04, 2013 @06:18PM (#6851229)
Thank you!
Re:Perl One-Liners by bierik on Thursday December 05, 2013 @02:24AM (#6853101)
After having seen the entry on HN, it took about 5 minutes and the print version of the book was ordered :). I've been using Perl on and off for more than 10 years, mostly for sysadmin and data munging stuff, and I'm always on the lookout for good short scripts. I'm looking forward to browse through the book (I still prefer print versions). I've bookmarked your blog as well.
Re:Perl One-Liners by oinksoft on Wednesday December 04, 2013 @06:36PM (#6851383)
Congratulations on getting published by No Starch! Your website is very useful, especially the sed one-liners.
Re:Perl One-Liners by pkrumins on Wednesday December 04, 2013 @06:37PM (#6851390)
Thank you!
Re:Perl One-Liners by draegtun on Thursday December 05, 2013 @04:47AM (#6853478)
If you're writing a lot of one-liners that use multiple modules then you may want to consider something like App::MyPerl - https://metacpan.org/pod/App::MyPerl
Re:Perl One-Liners by voltagex_ on Wednesday December 04, 2013 @10:34PM (#6852526)
Anyone else seeing weird font substitution in Adobe's reader with the PDF of this book?

perl -ne 'print "$. $_" if $a{$_}++' looks like it has 1s instead of ls - happens whenever the monospaced font is used.

Re:Perl One-Liners by hernan604 on Wednesday December 04, 2013 @08:45PM (#6852100)
Just send me one too :)
Re:Perl One-Liners by myrandomcomment on Wednesday December 04, 2013 @08:49PM (#6852114)
"Part of the fun of programming in Perl lies in tackling tedious tasks with short, efficient, and reusable code."

Reusable - I have always felt that Perl is a write-only language. :)

Re:Perl One-Liners by mst on Wednesday December 04, 2013 @10:08PM (#6852443)
Bad perl is write only.

Good perl is a different matter.

With great expressiveness comes great ability to express how bad you are at writing maintainable code.

Re:Perl One-Liners by pkrumins on Wednesday December 04, 2013 @08:54PM (#6852131)
Unless you make it many small shell aliases, such as these:

    urlescape () { perl -MURI::Escape -lne 'print uri_escape($_)' <<< "$1"; }
    urlunescape () { perl -MURI::Escape -lne 'print uri_unescape($_)' <<< "$1"; }
Then you can reuse them often. :)