Unpopular opinion, but I think we'd be so much better off if Netscape had just embedded a Perl interpreter instead of creating JavaScript. Perl CGI was already the dominant server side technology at the time and it has incredible string manipulation capabilities that would be beneficial for browser scripting.
Perl first commit: a “replacement” for Awk and sed
131–140 of 261 posts
Re: Perl first commit: a “replacement” for Awk and sed
#132The 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.
Re: Perl first commit: a “replacement” for Awk and sed
#133Earlier quoted context omitted.
> 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…
csh was a decent interactive tool, but not great for scripting. Bourne shell had the right idea but there were so many bugs in various corners of it (I still sometimes end up writing "test "x$foo" = "xbar" even though shells that need that are long gone). If you can depend on a recent bash and use shellcheck, then it's actually quite a pleasant programming environment, with fewer footguns than one might think. (I wan…
As for managing libraries, that's true, but you can certainly import and reuse some common util functions.
For example, this is at the top of most of my scripts:
set -eEuxo pipefail
_scriptdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
source "${_scriptdir}/lib.sh"
This loads `lib.sh` from a common directory where my shell scripts live, which has some logging and error handling functions, so it cuts down on repetition just like a programming language would.Re: Perl first commit: a “replacement” for Awk and sed
#134The 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.
The only way I could get Java 1.x to run (among my fleet of existing machines) was by installing the windows JDK version to run inside Wine on my Ubuntu.
Native Windows 10 could not run Java 1.x. This surprised me, since in my previous experience Windows was pretty amazing for maintaining reverse compatibility.
(I guess I could grab a super-old Debian docker image like Debian 6 and see if the linux Java 1.x binary would run on that, but I wanted to stick with machines I already had running.)
Re: Perl first commit: a “replacement” for Awk and sed
#135Earlier quoted context omitted.
> 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…
I don’t think you’ve seen the kind of scripts the person you are responding to is talking about. I have, and mentioned one lower down in the comments. Unix philosophy was great but does not scale well in terms of maintainability or efficiency. Invoking processes over and over again loops is godawful slow. And the horror of complicated shell scripts is legendary.
Re: Perl first commit: a “replacement” for Awk and sed
#136Earlier quoted context omitted.
> 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. It's the classic Unix approach of building small tools that do one thing well, and composing them in novel ways to solve problems. This works really well if your problem can be solved in one or two liners. It go bad very quickly when, say, you have two CSV files and want to join them the sql-way. In sed, you have to use positional variables and think about shell escaping. In…
Then just put them in a database and write a simple SQL query. If you use Perl it’s really very simple to do.
Re: Perl first commit: a “replacement” for Awk and sed
#137Earlier quoted context omitted.
I don't think comparing Perl to SQL quite works. There are currently plenty of other widely-used scripting languages that can do the same sort of thing that Perl does (if we consider it in the context of a general purpose scripting language rather than a sed/awk alternative), but the usage of SQL alternatives for querying relational databases is a rounding error.
It works because they both get shit on unfairly today. There’s still no substitute for either of them.
Re: Perl first commit: a “replacement” for Awk and sed
#138The funny thing is Perl is now arguably more obsolete than sed and awk.
When I used sed and awk a lot I also made heavy use of bash which makes things a lot nicer. And Python, of course.
Re: Perl first commit: a “replacement” for Awk and sed
#139Earlier quoted context omitted.
Yes. It's comparative. The absolute value of Perl's readability, maintainability, and general intuitiveness is massively better than all comparable tools that existed when Perl came out. Perl is a massive improvement over those tools. If you have doubts, try writing a complicated production software stack in awk. Then hand it off to a coworker. One need not be irreplaceably good, if one is already beating the current…
Moreover, as often as people joke about the readability of Perl code, that's entirely a function of the developer. I've easily written tens of thousands of lines of Perl, and not a single person has complained about difficulty reading or maintaining that code. Why? Because I apply all the usual best practices for code hygiene that apply to any language. Frankly, I think most people are just repeating a meme they hear…
Re: Perl first commit: a “replacement” for Awk and sed
#140Earlier quoted context omitted.
At the time, before everything became Linux, all these tools and the shells used to glue them together were an incoherent mess. Was your glue sh, ksh, csh, tcsh, bash or something uncommon like zsh? Did your grep, awk and sed use the same regexp syntax as your text editor? Single letter command line options, all meaning something different to each tool. Dozens of domain specific languages (shells, awk, sed etc.) mean…
Honest question-- why weren't the tools glued together or perhaps replaced entirely with the lisp inside Emacs? What was it missing?