News for hackers. Stuff that matters.
Re:Perl first commit: a “replacement” for Awk and sed by version_five on Saturday July 08, 2023 @08:46PM (#36650269)
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.
Re:Perl first commit: a “replacement” for Awk and sed by nmfisher on Saturday July 08, 2023 @09:29PM (#36650571)
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/Python etc.

FWIW I still write Bash scripts on a daily basis, too.

* that's no comment on Raku, which I consider a separate beast.

Re:Perl first commit: a “replacement” for Awk and sed by 77pt77 on Saturday July 08, 2023 @09:58PM (#36650758)
> 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 by em-bee on Saturday July 08, 2023 @10:29PM (#36650935)
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.

Re:Perl first commit: a “replacement” for Awk and sed by 2colours on Monday July 10, 2023 @11:22AM (#36667755)
Just imagine writing bash incorporating a sed script for something you can do with 20 keystrokes, then migrating the sed part to awk until it reaches 20 lines, then rewrite the whole thing to Python or somehow bridge it to the shell script - when you could have done the whole thing in Perl without feeling that it holds you back...
Re:Perl first commit: a “replacement” for Awk and sed by 77pt77 on Wednesday July 12, 2023 @05:56PM (#36702223)
> without feeling that it holds you back

This. I always feel like bash and pipes are always holding me back and resisting.

Python is just to verbose to exec/pipe/read/write.

The real issue is the it's really easy to shoot yourself in the foot with perl.

Re:Perl first commit: a “replacement” for Awk and sed by explaininjs on Saturday July 08, 2023 @09:00PM (#36650358)
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 by sidlls on Saturday July 08, 2023 @09:18PM (#36650493)
awk is a fantastic command line application that is useful for filtering, basic computations and transformations that other basic utilities (e.g. cut, sort, etc.) + grep don't (readily/easily) provide. I suppose it might be a bit archaic these days, but for someone familiar with it, it's often faster to compose an awk command than to write even a very quick/short script in, e.g., python or perl, for certain things.
Re:Perl first commit: a “replacement” for Awk and sed by fuzztester on Sunday July 09, 2023 @03:29AM (#36652422)
>awk is a fantastic command line application that is useful for filtering, basic computations and transformations that other basic utilities (e.g. cut, sort, etc.) + grep don't (readily/easily) provide.

All true.

But awk is also a programming language, not just a command line application or utility.

It has conditionals, loops, regexes, file handling, string handling, (limited) user-definable functions, hashes (associative arrays), reporting abilities and more.

In fact, the name of the original book about awk is The Awk Programming Language.

Re:Perl first commit: a “replacement” for Awk and sed by tharne on Sunday July 09, 2023 @10:03AM (#36654513)
> In fact, the name of the original book about awk is The Awk Programming Language.

Great book. I read it after it was so enthusiastically endorsed here on HN. A lot of people said it was worth reading just to take in the excellent technical writing style of Brian Kernighan.

I would offer a strong second to that.

Re:Perl first commit: a “replacement” for Awk and sed by fuzztester on Sunday July 09, 2023 @03:00PM (#36657718)
Cool. Yes, his style is good in his other books too, like K&R (C), K&P (Unix), and GOPL (Go), and The Practice of Programming.
Re:Perl first commit: a “replacement” for Awk and sed by SoftTalker on Saturday July 08, 2023 @08:52PM (#36650311)
Yep I responded in another comment but I use sed and awk almost daily but I never learned Perl. It's actually something that could be useful in my current role though -- is there a particularly good intro to Perl in 2023 that I might want to look at?
Re:Perl first commit: a “replacement” for Awk and sed by idlewords on Saturday July 08, 2023 @09:30PM (#36650575)
The Perl man pages are really good! Start with "man perlintro" and then look at whatever sections in the "man perl" table of contents fit your needs.

A lot of the tutorials online in my opinion are overbaked and written for people writing large OO projects using a lot of scaffolding. But the man pages were originally targeted at sed and awk users in your position.

Re:Perl first commit: a “replacement” for Awk and sed by SoftTalker on Saturday July 08, 2023 @09:50PM (#36650715)
Sounds perfect, thanks!
Re:Perl first commit: a “replacement” for Awk and sed by djbusby on Saturday July 08, 2023 @09:21PM (#36650508)
The wonderful thing about Perl is the docs from 2013 are still valid. All the growth/rapid-change/package-management issues that newer ecosystem suffer through Perl did in like the late 90s. 20 year old code still works (mostly). Not nearly the churn (anymore) as JS or PHP or Go or Rust.
Re:Perl first commit: a “replacement” for Awk and sed by em-bee on Saturday July 08, 2023 @10:25PM (#36650911)
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 by fuzztester on Sunday July 09, 2023 @03:34AM (#36652445)
>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.

Can you name some? I'm guessing Rexx is one of those you mean.

Re:Perl first commit: a “replacement” for Awk and sed by em-bee on Sunday July 09, 2023 @06:17AM (#36653214)
i am talking about the popular classics that many others here mention, python, ruby, php, and the many others that came after them.

with the older ones i mean languages like lisp and smalltalk which didn't become available for free or even usable on PCs until the 90s

i am not saying that they are all replacing perl, but that perl was used in areas where they are better suited, and with their appearance perl is no longer needed in those areas, hence the usage space for perl shrunk a lot.