176 points · by nixcraft · 4y ago · 137 comments
One interesting thing I've noticed about perl is that almost all the examples of how to do something online are absolutely terrible. Our codebase is good because we learned how to write perl clearly, and it looks nothing like how we started out from examples.
Anyways, I don't really have a point, except to say Perl really is amazing, even if it's not really growing nowadays. I think it will be around for ages to come.
Yeah, that's definitely a problem with systems that have evolved over so long. I feel like C++ is kind of in the same boat: certainly what I learned 20 years ago is not relevant to how its done today.
The Internet is a wide repository of knowledge, but Perl really needs a "How To Perl in the 2020s" repository. A book would be good, but for wide reach, it'd really need to be online.
I'd like to see a site, perhaps a wiki, that has sections for various technologies (programming languages, operating system, applications, frameworks, libraries, protocols, etc).
For each, it would have some sort of list that lets you tell what from X years ago is still relevant when using that technology today.
In particular, I'd like it to include a list of good past books on that technology and for each tell you what from it would still be applicable as is, what would require minor modifications, what would not be useful, and what would be harmful if you were to try to use that book to learn that technology at the level covered by that book.
For example, it has been 20 years since I did any serious low level networking. If for some reason I needed to get back up to speed on that for some new project could I reasonably start by grabbing my copies of Stevens' "TCP/IP Illustrated" series [1] from my library and rereading them?
I’m in college and just took a course including Perl and I suggested to the instructor that students get taught functional programming skills through real life applications that are progressive learning skills.
Start with the greatest books every written:
Programming Perl - https://www.oreilly.com/library/view/programming-perl-4th/97...
Continue with the second greatest book ever written:
Intermediate Perl - https://www.oreilly.com/library/view/intermediate-perl/05961...
Followed by equally amazing book by the greatest programmer in the world:
Higher Order Perl - https://hop.perl.plover.com/
And of course:
Mastering Perl - https://www.oreilly.com/library/view/mastering-perl/97805965...
To get super quick in the command line, also you might want to get my book:
Perl One-Liners Explained - https://nostarch.com/perloneliners
Finally, join #perl on Libera Chat.
AS A NEW USER WE LOVE YOU WITH GREAT HUGE LOVE.
(Also screw all Python programmers, what a bunch of losers with their indenting rules and PEPs. Weirdos. Whenever you hear somone say Python is good or interesting, run.)
> (Also screw all Python programmers, what a bunch of losers with their indenting rules and PEPs. Weirdos. Whenever you hear somone say Python is good or interesting, run.)
Even as a jest, it's a poor representation for the Perl language.
Python has problems but has enjoyed success for a few reasons.[1] I think one of the worst side-effects of Python is that Python programmers tend to look at any powerful language with disdain if it has any non [a-zA-Z] characters. "Can't we just replace everything with Python?!"
Becoming a language bigot -- or joking like one -- does not help.
Perl can stand very tall on its expressiveness, stability, speed and simplicity.
[1] I'm going to say...
a) Python is more readable, but makes the crazy compromise of using whitespace as logic.
b) Python has adequate threading for many use-cases.
c) Python's built-in OOP has better affordance than Perl5 OOP. BUT... Perl enables building anything you want. If you want a dictionary with only two methods, you can build it. And Perl5 will have a more modern OOP implementation.
As a somewhat "new" sysadmin/coder back in the early 2000s, those blue O'Reilly books were like a business card, comfort blanket, and encyclopedia all in one.
I'd add "Mastering Regular Expressions" and maybe "Perl Best Practices". Oh and definitely "The Perl Cookbook", because it mirrored the way I learn best; from needing to do "a thing" and finding an example that mostly fits what I need.
I think you do the language a disservice and associate Perl with childish views on other languages.
May explain why Perl is struggling.
I really hoped unintelligent bashing of languages died out after those of us who were 12 in the 90s grew up and realised peoples tooling isn't a personal statement.
I now program almost exclusively in Python (it's good and interesting) and Java. But occasionally I fall back to Perl for something that is just so much simpler - almost muscle memory.
Amen. This is my credo.
I had to program Python in my last job and I ran as fast as I could from that world of artificial limitation, and landed squarely in the land of camels and onions: The Promised Land.
I applaud this, standing.
How do I tell it to just put shims in ~/perlBin?
You can use a known good env manager like perlbrew, perlenv, bootstrap-perl, perlall to work around the problem you're seeing until HB is fixed.
It has had a few tweaks over the years, and is now nearing 20 years of age. I've used it in different companies I have worked for.
The job I had the most fun at was probably one in which I had to extract data from various documents (xls, doc, etc). All with Perl, of course. I don't think any other language or library would have enabled me to be so productive at this particular task.
So congrats to this wonderful language and its creator, Larry Wall.
Nowadays it would be rather easy to do it on python or ruby with a library that reads these filetypes.
With Rivescript you could even write a chatbot, and OFC the "original" one for Perl was "MegaHal". Also, it made pretty easy to bind the chatbot to an IRC network (and later, MSN and Jabber).
Good times.
The only other comparable language is Clojure, where backwards compatibility is treated as a priority, and I can still run my programs from 12 years ago without a hitch.
This is important, and it is something that you learn to appreciate as you get older. When I was 25 I also didn't care.
Using what's now called Test Anything Protocol[2] (TAP).
[1]: https://github.com/Perl/perl5/commit/8d063cd8450e59ea1c611a2... [2]: https://testanything.org/
Migrating hundreds of thousands of email accounts from one system to a new one. Source information was variously LDAP, custom information systems, Lotus crap, etc etc. Destination was another LDAP server. Perl took all that text in, munged it around, then loaded it into the destination. Back then I didn't know it was called ETL, and to me it was like magic that I had written.
Out of all the ETL systems and languages I've encountered over the years since then, Perl has been the fastest to develop and most flexible. The "text in, regex or otherwise select into objects, transform stuff, then transmit to server" abilities of Perl were just so slick.
Also, Perl is partly responsible for my move to the USA. Slashdot and its associated Everything2 site were written in Perl, and I met my (now-ex) wife through Everything2.
Thank you, Perl, for being pretty danged awesome and oh so flexible. :)
EDIT: and thank you Larry Wall for showing me that programming doesn't have to be stodgy and boring, that language has beauty.
That really takes me back!
Paradoxically, Perl 6/Raku's extremely long development cycle has led to Perl 5 "stagnation", in other words stability, which is a good thing.
Personally, I didn't like that Perl has spoiled the concept of regexps with (Turing-complete?) constructs when it originally was beautifully aligned with the regular/context-free-and-above language dichotomy.
And that Perl came to replace my beloved, and portable, awk/shell scripts.
Aaand that Perl, for a while, usurped the ".pl" file suffix, when everybody knows it belongs to Prolog programs.
(Nowadays, the most common filename size limit seems to be either 255 bytes or 255 characters, depending on the filesystem.)
It turns out some people have been studying this for Java: https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.94...
That system ran a few small exchanges for many years. I doubt anyone who traded on them knew that their orders were handled by a big Perl system.
Later after devouring the dragon book and learning YACC and so on it was hella fun to write parsers in 'C' for my new employer. In fact I got a contract to do some data munging for a gas pipeline because their processes needed some serious help, and that's when I discovered PERL. Larry Wall's reporting language turned me into a super hero because although I was already fast dealing with data, PERL meant I could turn around any request in a few hours. It was (and still is) amazing.
// ==UserScript==
// @name Mute users
// @namespace Violentmonkey Scripts
// @match https://news.ycombinator.com/item
// @grant none
// @version 1.0
// @author -
// @description 12/18/2021, 9:43:19 AM
// ==/UserScript==
const mutedUsers = ['usernamehere']; // <== CHANGE THIS
window.addEventListener('DOMContentLoaded', mute);
function mute() {
for (const mutedUser of mutedUsers) {
const result = document.evaluate(`//*[@class="hnuser" and text()="${mutedUser}"]/ancestor::*[contains(@class, "comtr")]`, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE);
for (let i = 0; i < result.snapshotLength; i++) {
const el = result.snapshotItem(i);
el.remove();
}
}
}This isn't a "wait a bit and things will be fine" situation.
Flagging and voting has always been controversial on HN, but when it doesn't work at all even with those — I have no idea how it could work with slightly controversial political stuff.
news.ycombinator.com##tr[class="athing comtr"]:has(a[href="user?id=usernamehere"])Then in 1999, Red Hat files an IPO and offers free shares to open source developers. That blurb in the perl source got got me included in the Red Hat IPO but the email was so strangely worded I assumed it was spam and deleted it. Oh well.
I routinely use awk and sed today, and avoid Perl like the plague. My experience says that something went very wrong in trying to achieve that initial design goal.
I mean I still write Perl for my day job, and I like the language, but unfortunately that doesn't change the reality.
Some days you just want to work on something simple, something old-school, and for those days, Perl is happiness.
If anyone reading this is looking for a new challenge and loves Perl, do give me a shout.
Happy Birthday my old friend!
I started using it in the early 90s and it's paid the bills ever since.
Thanks to Larry and the whole community.
Jokes aside, Perl is the swiss-army knife of programming. It can do anything, most Linux variants have some version of Perl installed, and you can cut yourself very easily.
Most of my work goes through evolutions depending on eventual use. Many staying in the first phase.
Proof of concept/one shot work just needed by me: Perl
Needed by internal or external developers who know what they are doing: Python3 rewrite
Needs to be robust: Java/C/C++/Rust
The speed with which you can prototype by piecing together micro C programs mixed with Perl orchestrating them is really something that has benefited me throughout my career!
Where I work our most popular site is written in Perl. It keeps running.
Our previous intern wrote the processing pipeline that I just ran this week in perl that processes 100s of gigs of NCBI data into our database tables. It’s totally the right tool for this job.
I find it a beautiful and at times difficult to maintain. CPAN is amazing until it’s not. Though the fact Perl 6 failed means less having to update these backend scripts which is nice).
I've heard that these days they've moved to Python (which reflects my own preference for writing scripts). I still use Perl for cli one-liners when sed/awk aren't enough.
I have written some pretty nasty Perl code, and some that I thought was pretty clean. I have saved massive amounts of my and other people's time with Perl.
But over the last several years, I have written more Python, to the point that I run "perl -c" on a one-off script, and wonders why it objects to "def myfunc {...", and I leave out semi-colons. I write the Python because the young now seem to have learned Python in middle school, and they're going to be in the workforce a good deal longer than I am.
[edit: added URL for SATAN]
So gradually over the years I've dipped in and out of Perl. I've found the learning curve much steeper than Python, or even C, but once surmounted the payoff is immense.
So I eventually wrote my own static website generator in Perl, available here for the curious:
https://github.com/lordfeck/rsru
A sample of what it generates is here:
Even lately at work, I was tasked with the tedious job of manually converting JSON files into Excel for a customer to review, then we'd have to convert them back to JSON.
Guess what I did instead ;)
The few python test runners I maintain cause much more trouble and do much less, than my dejagnu, autotools, cmake, or shell test runners. But when I'm needing a mock service to test against, I happily use python (or just C). A multithreaded C server is still easier written in C than python or perl. And 100x faster.
Wrote my first CGI script in 1998 to be hosted on Hypermart.
I’m still maintaining a large Perl project these days. Mostly out of love, not money.
But my heart is in TypeScript these days :)
I recall struggling to get the correct GD libs installed that supported GIF and JPG so I could build the GD Perl mod.
That obviously didn't age well.
I've never programmed in Perl, but a couple years ago I read a Raku book and was delighted with the language. At the time, I was interested in learning a new scripting language. Raku and Tcl were at stake. I built a small script to compare the run speed and Raku was about 40 times slower than Tcl for my use case, if my memory is not betraying me. So, I went for Tcl that I also like very much.
Still, there's some opportunity for Perl, as I may need it in the short future.
From the features of Raku that are mentioned in the home page, namely: 1. Object-oriented programming including generics, roles and multiple dispatch 2. Functional programming primitives, lazy and eager list evaluation, junctions, autothreading and hyperoperators (vector operators) 3. Parallelism, concurrency, and asynchrony including multi-core support 4. Definable grammars for pattern matching and generalized string processing 5. Optional and gradual typing
what are the ones that will be available for Perl7, which I've already read that will be similar to the last Perl5 with saner defaults?
:)
https://github.com/Raku/problem-solving/pull/89#issuecomment...
There was the personal realization that the two factions in what was then the Perl community, would never see eye to eye on what the language called "Perl 6" was. And that all of my efforts of reconciliation, such as the Perl Reunification Summit http://blogs.perl.org/users/gabor_szabo/2013/02/perl-reunifi... had been in vain.
Which lead me to open an issue https://github.com/Raku/problem-solving/issues/81 which in the end resulted in the rename to the Raku Programming Language https://raku.org .
I'm sorry about your efforts being in vain. That sounds exhausting and demoralizing.
What are you up to now?
https://perl6advent.wordpress.com/2015/12/25/christmas-is-he...
[1]: https://www.perl.com/article/announcing-perl-7/?ref=alian.in...
I've seen things, you see, terrible _ things.