Live data from Hacker News

Perl first commit: a “replacement” for Awk and sed

github.com

21–30 of 261 posts

Re: Perl first commit: a “replacement” for Awk and sed

#21
post #9

I used to kind of unfairly disparage perl, but now I regret never learning it. I've written a lot of scripts for munging text/files that outgrow bash, and when I rewrite in Python they get twice as long. Seems like perl would be a happy medium and let me keep using a lot of the nice bash shortcuts like `baskticks` for shell execution, etc

Yeah so many people shooting themselves in the foot by failing to take advantage of this powerful tool - as you say especially for stuff that you might have otherwise used an overly-complex bash script for.

I find Python much easier to read and write, whereas I find it hard to write Perl as anything but an unstructured blob. Its main advantage for me is that interpreter startup time is significantly faster than Python, Ruby, Node, and most Scheme implementations. So it's useful if I ever need to call an external program for some text processing inside a shell script. Otherwise I strongly prefer the maintainability of Python.

Re: Perl first commit: a “replacement” for Awk and sed

#22
post #2

The funny thing is Perl is now arguably more obsolete than sed and awk.

My first thought when I saw this was that I'd like to see some stats on use of the three. I personally use sed and awk regularly and never perl, but I have no idea what is typical. I have a feeling that most people (amongst those who may have a use case) don't use any of them.

Google Trends has sed crossing over perl about 5 years ago. Awk seems insignificant, which matches my expectation. (I’ve used sed but never awk, I don’t even know what it does)

Worth noting “sed” is “thirst” in Spanish, which has the potential to throw off the data, especially worldwide.

https://trends.google.com/trends/explore?date=all&geo=US&q=p...

Re: Perl first commit: a “replacement” for Awk and sed

#23

I used to kind of unfairly disparage perl, but now I regret never learning it. I've written a lot of scripts for munging text/files that outgrow bash, and when I rewrite in Python they get twice as long. Seems like perl would be a happy medium and let me keep using a lot of the nice bash shortcuts like `baskticks` for shell execution, etc

Try xonsh. It's an unholy merging of python in a shelllike syntax. It can work as your system shell and/or you can write scripts in the superset of python.

Re: Perl first commit: a “replacement” for Awk and sed

#24
post #9

I used to kind of unfairly disparage perl, but now I regret never learning it. I've written a lot of scripts for munging text/files that outgrow bash, and when I rewrite in Python they get twice as long. Seems like perl would be a happy medium and let me keep using a lot of the nice bash shortcuts like `baskticks` for shell execution, etc

Yeah so many people shooting themselves in the foot by failing to take advantage of this powerful tool - as you say especially for stuff that you might have otherwise used an overly-complex bash script for.

Now with LLMs to reduce feature discovery pain there is less of an excuse!

Edit: this applies to any language not just Perl. I use it to learn Python things I would otherwise miss.

Re: Perl first commit: a “replacement” for Awk and sed

#25
post #17

When perl came out we were living in horrific times. You had the choice of either Bourne, C or Korn shell. Automation was glued together in one of these with a series of grep, awk, sed, ls, test, commands glued together. Anything more complicated was written in C and called from one of these things. Perl in one stroke collapsed the programming of C, text manipulation, the capabilities of all of the Unix utilities, an…

> Yes, awk and sed were replaced by Perl, I still use awk and sed semi regularly. I haven’t used Perl in over a decade.

Sounds like you were also replaced by Perl.

Re: Perl first commit: a “replacement” for Awk and sed

#26
post #2

The funny thing is Perl is now arguably more obsolete than sed and awk.

I use Perl scripts dozens of times a day but I rarely write new code in it. awk and sed I use less often but it’s almost always ad hoc new scripts.

Re: Perl first commit: a “replacement” for Awk and sed

#27
post #9

I used to kind of unfairly disparage perl, but now I regret never learning it. I've written a lot of scripts for munging text/files that outgrow bash, and when I rewrite in Python they get twice as long. Seems like perl would be a happy medium and let me keep using a lot of the nice bash shortcuts like `baskticks` for shell execution, etc

Yeah so many people shooting themselves in the foot by failing to take advantage of this powerful tool - as you say especially for stuff that you might have otherwise used an overly-complex bash script for.

I once went looking for something like Ansible that was implemented in Perl. Does such a thing exist? I think declarative system orchestration got popular well after perl's popularity declined. In any case, I did not find anything.

Re: Perl first commit: a “replacement” for Awk and sed

#28
post #2

The funny thing is Perl is now arguably more obsolete than sed and awk.

Unix was always about tools doing one thing. Obviously awk and sed didn’t do one thing only, but Perl broke away from that entirely. Perl tried to replace awk, sed, and the shell all at once.

The problem with Perl is it was still tied to Unix culture to compete with Python and it’s strong library set, so it was pretty much fazed out as an awkward intermediary.

Re: Perl first commit: a “replacement” for Awk and sed

#30
post #2

The funny thing is Perl is now arguably more obsolete than sed and awk.

My livelihood depends on a large set of Perl scripts, and I bet I'm not the only one in that position. It's perfect for gluing things together and then not breaking for decades, while other languages come and go. It's kind of the new COBOL that way.
Post reply on HN