Hacker News new | ask | show | jobs
by jph00 1073 days ago
That might be true culturally, but it's not true technically. Once you know a bit of Perl (including some command line switches like -e, -n, -a, -l, -p, and -i) you will be able to do just as easily everything you used to do in awk and sed, but with a more powerful foundation so you have the flexibility to go further.
3 comments

> but with a more powerful foundation so you have the flexibility to go further.

The question is: should you?

I like Perl, but it itself has many warts that make maintaining a large codebase more of a nightmare than using C, and certainly more than most modern languages.

I agree with other commenters here that the tools Perl sought to replace are still used more than it. It has its niche of being excellent at text processing, and more capable than shell scripts at that task, but I'd think twice about reaching for it to build anything more complex than a shell script replacement. Especially in 2023.

What's a good resource to be proficient in perl for shell scripting?

I write a lot of bash for better or worse. I wonder if perl would be a better choice sometimes.

If you can't manage it with Shell scripting you should take a look at Python.

I've written Perl for many years but in the end switched to Python because the internet and resources you can find are much more quantitative and qualitative than those for Perl. Especially now when Google doesn't seem to return older results anymore.

I'd rather write perl tho
Worse Is Better syndrome.
"Minimal Perl" by Tim Maher is unrivaled for this.
Thank you for mentioning that book - I'm very interested in how perl can replace awk and sed and even grep(!) - I use grep multiple times a day, awk maybe a few times a week, and sed very rarely. I think I'm in the target demographic for this :)
The book constains Perl one-liner-style equivalents of these UNIX utilities which you can just drop into your bin directory.
Cool, I'm in the market for that.
For Perl-style grep there's also ack and it's successor ag which you might want to look at first.