5 ms·
For example removing something from a file and then talking to a database or a web service, ... Deal with multiple files, or other advanced use cases. I do e
by Annatar 8y ago
For example removing something from a file and then talking to a database or a web service,
...
Deal with multiple files, or other advanced use cases.
I do exactly this every day with AWK. Solving exactly these kinds of problems features prominently in the AWK programming language book.
- kamaal 8y agoIt goes further. Awk is when you entire use case fits into the category of iterating lines in a file. Perl is that plus more things.
- Annatar 8y agoPerl simply isn’t worth it. In all the decades of programming, I’ve yet to run into a problem which could only be solved in Perl because it couldn’t be done in AWK. And I would hereby like to remind you that every computing problem is fundamentally an input-output problem, and because of this intrinsic property, it is possible to reduce all problems in computing to input-processing-output. Which is exactly the kind of problem AWK is designed to address. And AWK doesn’t work with lines, it works on records, for which the fathers of the language cleverly chose the default of ‘\n’, which is reconfigurable.
- textmode 8y ago"In all the decades of programming, I've yet to run into a problem which could only be solved in Perl because it couldn't be done in AWK." Have you ever pondered the number of projects that, in addition to sh, make and common base utilities, require perl during compilation where awk could have sufficed? As a single example, have you looked at compiling openssl without perl, using awk instead? Whenever I see a perl prerequisite I question whether it is truly a requirement or whether other base utilities1 such as awk could replace it. Assuming it could be removed, how much effort is one willing to expend in order to extinguish a perl dependency? 1. Some OS projects like OpenBSD make perl a base utility.
- Annatar 8y agoThe illumos project undertook a massive effort to eradicate any and all dependencies on Perl (which had also been made part of the core operating system decades prior, by themselves no less). While they're still at it, they have managed to rip out most of it and replace it with binary executables in C or shell. Yes, writing a build engine in AWK would be perfectly doable, but the right tool for that job is Make.
- kamaal 8y agoThat's easy to do. But that's not the end of it. The whole point of Perl is avoid a salad of C and shell utils. Also in many cases the moment you have to deal with >2 files at a time shell utilities begin to show their limits. The resulting code is often far more unreadable than anything you will ever write in Perl.
- Annatar 8y agoI’m sorry you believe that, but it’s simply not true, especially since UNIX is designed to be driven by a combination of binary code and shell executables. Perl is a mess whose syntax borders on hieroglyphic once poured into software. That doesn’t mean that it’s not a capable language; but it’s not a language in which written programs are maintainable or easily debuggable.