logoalt Hacker News

syncsynchaltyesterday at 9:56 PM2 repliesview on HN

Code golfing originated in perl.

There was strong cultural pressure to be able to write perl in as few bytes as possible, ideally as a CLI one-liner. Books[1] were written on the topic.

https://www.thriftbooks.com/w/perl-one-liners-130-programs-t...


Replies

nocmanyesterday at 11:18 PM

> There was strong cultural pressure to be able to write perl in as few bytes as possible

Hard disagree. Many Perl programmers enjoyed engaging in code golf (always just for fun, in my experience), but in my nearly 30 years of programming Perl, I never encountered anything that I would call pressure to do so -- not from anyone.

creeryesterday at 10:59 PM

One-liners is one of the ways you can use perl. You can also use it as the embedded language in some larger project. As perl CGI. As mod_perl. etc. There is no "cultural pressure" to use any of these. You can choose to mess around with one-liners and you can choose to spend time shaving a few characters off your code. Or not. None of this is the one true way. This is not python.