Live data from Hacker News

Half My Life with Perl

perladvent.org

91–100 of 139 posts

Re: Half My Life with Perl

#91

I’m about to turn 40 and have been thinking if I should learn Perl or AWK or go with a “modern” solution for text wrangling on the command line. The general advice here seems to be “learn Perl while young”

depends on what you mean by "on the command line".

I personally find python most useful to learn, especially in combination with invoking a real editor to edit multi-line commands:

bash has C-x C-e and the `fc` buildin, other shells have equivalents.

https://www.gnu.org/software/bash/manual/bash.html#index-edi...

I have extensively used awk and it's lacking when mid size problems become larger projects.

I also have used perl quite a bit, and if you love the "sigil" you can become very, very happy with perl. I personally never go warm with sigil, I have developed sigil-itis, so to speak.

Re: Half My Life with Perl

#92
post #58
post #41

Earlier quoted context omitted.

What's the modern solution to text processing on the command line? I don't think anyone tried seriously addressing that use case after Perl. Like, obviously you can do text processing in any language, but you're not going to be doing it in the context of shell pipelines and one-liners. The preferred interaction modes are totally different.

I've been disappointed to see a massive uptick in people writing a whole Python subprocess script instead of just an awk column select. They usually know awk, but Python is more familiar so they replace ten characters with a couple hundred. It seems like fewer even want to learn a shell pipeline.

There was actually attempts to recreate Awk inside Python. See https://github.com/alecthomas/pawk

Re: Half My Life with Perl

#94
That was a great talk! Notice how his entire career got launched from an internship at Tektronix. I love the bit about how he found his own troff macros in use at O'Reilly because a coworker had taken his code there years before -- and he appreciated that! One might say that the same kind of "80's hacker ethic" is what got him into trouble at Intel.

The Camel book was so well-written. It was my introduction to Perl, which became my "superpower" in the 90's and far longer into the 2000's than I tend to admit. I eventually switched to Python because it's the closest thing that is considered an acceptable "modern" choice. I really enjoy Python too, but the obligatory XKCD about Python[1] rang true for me about Perl first.

For me the #1 superpower strength of both languages is the first-class treatment and syntactic sugar for associative arrays (a.k.a. hashes, dictionaries).

Perl did the same for regexes and file I/O; Python did not.

I have come to appreciate Perl's backwards compatibility -- that old scripts still run unchanged -- though maybe that's largely because Perl 5 has been in maintenance mode for so long.

[1] https://imgs.xkcd.com/comics/python.png

Re: Half My Life with Perl

#95
post #7

Earlier quoted context omitted.

I’m into lisp and vim. I did one small project with Perl but wasn’t excited. I was hoping for bash 2.0 but the shell integration wasn’t great. Seems like python is a similar feature set, less exotic, and has great libraries. Anyway? What did I miss? anything I should take a second look at?

Raku is basically perl 6 and has some features that blew my mind when I tried it a few years back. Never really did much with it, but it was enjoyable to learn.

This encapsulates every conversation I have ever had with someone who tried Perl 6: Tried it, was blown away with [some aspect of it], never found anything practical to do with it, never used it again.

Re: Half My Life with Perl

#96
post #12

Earlier quoted context omitted.

I'll be frank: I think this idea that ${faveLang} is for misunderstood geniuses who truly understand computers where mainstream languages like Python are for dunces who only know how to glue together APIs is a large part of why such languages as Perl are nearing extinction. It turns out that there are people working on challenging problems in domains you've never heard of in Python -- and pretty much every other lang…

>>In the real world, the ability of a lone genius to cobble together a script in an hour is actually not that much of an edge Any macro/multiplier is that way. You don't miss it, until some one shows you how to do it. In the last six months alone the scenarios where I had to call upon Perl to help slam dunk a thing insanely laborious are dozens in number. Its just that if you don't know this, or don't know it exists,…

You are missing my point. For transparency, you are talking to someone who writes Racket in emacs on my Linux desktop, has used Rust macros to clean up awful code in widely used open source packages, and regularly generates code for all manner of purposes in lots of different languages. I know the slam dunk feeling of generating exactly the code that will topple a problem -- and I also know it's not actually that big an edge!

It matters little that you can generate code in an hour that would take your colleague days. It is nice for you and it provides a short lift for your team, but in the limit what matters is maintainability. Peter Hintjens writes fondly of metaprogramming and code generation, but also warns that it makes it difficult for others to work with you, and it's easy to fall into the trap of building abstractions for their own sake. The "edge" in technical work comes from seeing both the forest and the trees, and missing that technical work is in service of humans, first and foremost.

I am glad you enjoy writing Perl, and I like encountering people passionate about it in my work. But I still think there are good reasons why it's in decline, and Perl users should reflect more on that rather than assuming people aren't using it because they are dumb / not technical enough / don't think about problems as creatively or deeply.

Re: Half My Life with Perl

#97
I came here to say: not just text processing. Thirty-odd years ago I worked on a government contract supporting users of Data General minicomputers. From time to time we needed to inspect the logs, but the log reading utility was not fast. The log format was thoroughly documented, though, and it proved to be much faster to ship a log over to a Sun box and pick it apart with Perl using unpack.

Re: Half My Life with Perl

#99

Earlier quoted context omitted.

I can't recall what modules my boss created but he had heart attack and passed away. So his modules are now left unmaintained. Fortunately, new version realises of perl don't break CPAN modules that much. But there have been a decrease and of programmers that have either moved on or are passing away. Without a younger audience not to maintain they're left to rot. Python will encounter the same when a new language hit…

This is terribly sad to hear. Perl used to be so ubiquitous and it is sad to see that it is rapidly fading away. I know of no one in my friend circle who has EVER used Perl.

Perl has been my go-to language for years now. Just yesterday I needed to write a little tool to stream some scraped metrics into a ClickHouse database. I was shocked to see that there aren't first-class Perl libraries for ClickHouse, and those on CPAN are seemingly fairly old/unmaintained. That's a real bummer.

I could always go with the MySQL interface, but I'd prefer to stay native if possible.

Re: Half My Life with Perl

#100

Perl is my first love, and I still whip it out from time to time to do system tasks (anything in the linux world). It is literally installed on any *nix OS, macOS included. Python is fine, but it’s not as universal as Perl. I also feel like Perl is more “batteries included” as many times I can be productive without “use”ing any libraries. It’s has been my secret weapon over the years. I’ve also noticed that most youn…

> It is literally installed on any *nix OS, macOS included.

To my horror/surprise, not necessarily so any more. A whole lot of the OS parts that used perl have been ported away, or no longer part of the OS. It's entirely possible to run production workloads on RHEL without perl installed, for example.

I had a nice perl script I'd written ages ago that I sort of trundled around with me for a while, that could extract multi-line stack traces from plain text logs if any of the lines matched a certain string, and couldn't because no perl. I had to quickly rewrite it in python (wasn't hard to do, admittedly)

Post reply on HN