Live data from Hacker News

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

github.com

61–70 of 261 posts

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

#61
post #13

I will always love perl because it got my career off the ground. Anyone who doesn’t just learn it is doing themselves a disservice. It’s similar to SQL in that sense.

Perl is still great for data munging and ETL. I use it a lot to load data into databases and Elastic indices.

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

#62

Earlier quoted context omitted.

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.

Ditto - I use sed/awk daily, but I never write Perl any more (though I do use older bash scripts that call Perl under the hood). I'm still comfortable recommending people learn sed/awk but I don't think I'd recommend learning Perl* now. It sits in an awkward spot between the simplicity of GNU utils and the expressivity of a scripting language, but doesn't do either of those things better than the equivalent sed/Pytho…

> simplicity of GNU utils and the expressivity of a scripting language, but doesn't do either of those things better than the equivalent sed/Python etc.

It does scripting and gluing scripts far better than python.

It's not even close.

I'm not even going to address sed, awk, bash and the like.

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

#63
post #8
post #2

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

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.

> 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.

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

#64

I know people dump on Perl all the time, I know I do. But it was a critical part of computing history. Perl did a tremendous job of bridging the gap between shell commands and shell scripts and “big languages”. Way back in the early 90’s I took a complicated shell script that took about 2 hours to run this huge text processing job , rewrote it in Perl and it took about 20 seconds, and was more maintainable to boot. I…

During a later period (early 2000's) Perl was the only scripting language with good Unicode support, including inside regular expressions, which was revolutionary at the time. There was so much cool stuff you could only do in Perl, and then like you say it all ran into the brick wall of Perl 6.

Yes and Perl’s Unicode transition between 5.5 and 5.6* was exemplary. There were some speed bumps but generally old stuff continued to work and Unicode support could be added in a straightforward manner. In contrast to how python 3 handled it (not trying to start a language war, these days I prefer python overall). I suspect Larry Wall just understood text processing much more deeply than Guido (makes sense since he is a linguist and Perl was always more text oriented).

*technically it was 5.005 or something to 5.6 because they decided to drop a zero or two

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

#65
post #42

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…

> 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. This doesn't sound that horrific to me. It's the classic Unix approach of building small tools that do one thing well, and composing them in novel ways to solve problems. For any problem that can't be solved this way you wri…

you probably shouldn't abuse shell scripts to build a complex system, and beyond a certain level of complexity, a programming language is the better tool

but the only free programming languages available at the time were C/C++, various shells, and awk. everything else was expensive or not generally usable for other reasons. all the really useful languages to build complex systems didn't really appear or become freely available until the 90s. and perl was first among those.

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

#66
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.

join(“ “, @{$ounds->{really}{&fun}}) =~ /^[a]n+d\sgr8 4 (you(r|se) eye$/g

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

#67
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.

Agreed. I would turn to Python for anything more involved that couldn’t be done very directly and efficiently using awk/sed. I would never use Perl for anything.

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

#68
post #42

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…

> 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. This doesn't sound that horrific to me. It's the classic Unix approach of building small tools that do one thing well, and composing them in novel ways to solve problems. For any problem that can't be solved this way you wri…

> This doesn't sound that horrific to me.

I think it's possible that things that seem normal and inoffensive can become horrific simply from scale. You'll climb the stepladder without complaint, but then there's that radio tower in Canada...

Others like the idea of the family cow, then they see the 10,000 head feedlot from the highway.

Scale is sometimes sufficient by itself to induce horror.

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

#69
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.

it's not about stats but simply that the space between simple shell scripts and complex systems that required "big" language, which used to be filled by perl has shrunk a lot because it is filled with many other languages that are better suited for larger systems than perl is. for most uses of perl today there are a dozen other suitable languages, including some that are older than perl but were not freely available at the time.

stats wise i am sure there are still a lot of perl users. it has its fans, and there is a lot of existing systems, but it is now a choice among many, and not usually the best choice.

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

#70
post #62

Earlier quoted context omitted.

Ditto - I use sed/awk daily, but I never write Perl any more (though I do use older bash scripts that call Perl under the hood). I'm still comfortable recommending people learn sed/awk but I don't think I'd recommend learning Perl* now. It sits in an awkward spot between the simplicity of GNU utils and the expressivity of a scripting language, but doesn't do either of those things better than the equivalent sed/Pytho…

> simplicity of GNU utils and the expressivity of a scripting language, but doesn't do either of those things better than the equivalent sed/Python etc. It does scripting and gluing scripts far better than python. It's not even close. I'm not even going to address sed, awk, bash and the like.

if you have a script that makes heavy use of sed, awk, tr and the like, then maybe translating to perl would be most natural.

but otherwise a script is either just calling a lot of commands one after the other, for which a shell script is fine. or they do a lot of data mangling without needing many external applications or none even, in which case any other languages besides perl is just as fine.

Post reply on HN