Why is Perl installed by default with most Linux distributions?
The answer is/isn't sexy, depending on your point of view.
Perl is very useful. Lots of the system utilities are written in or depend on perl. Most systems won't operate properly if Perl is uninstalled.
A few years ago FreeBSD went through a lot of effort to remove Perl as a dependency for the base system. It wasn't an easy task.
In Larry Wall's original Perl v1.0 posting to the comp.sources.misc newsgroup on December 18, 1987, he said:
If you have a problem that would ordinarily use sed or awk or sh, but it exceeds their capabilities or must run a little faster, and you don't want to write the silly thing in C, then perl may be for you.
In a much later exposition, he elaborated a little more:
But the frustrations of Unix shell programming led directly to the creation of Perl, which I don't really have time to tell. But essentially, I found that shell scripting was intrinsically limited by the fact that most of its verbs are not under its control and hence largely inconsistent with each other. And the nouns are impoverished, restricted to strings and files, with who-knows-what typology...
More destructive was the mindset that it was a one-dimensional universe: you either programmed in C or you programmed in shell, because they're obviously at opposite ends of the One True Continuum. Perl came about when I realized that scripting did not always have to viewed as the opposite of programming, but that a single language could be pretty good for both. That opened up a huge ecological niche. Many of you have seen my old clamshell diagram, with the two dimensions of manipulexity and whipuptitude.
Today, Perl is a standard alternative/replacement for shell-scripting and text parsing needs, and with much more power than the traditional tools. Because of it's extreme (some would say inelegant) flexibility, Perl has been described as "the Swiss Army chainsaw of scripting languages". Tasks can often be significantly shorter, easier, or more extensible when solved with Perl. Many, many system tools, scripts and larger programs are routinely written in Perl. So in the modern Linux environment, Perl is now another standard Unix tool, and truly indispensable.
- Perl was developed for Unix because the tools were not powerful enough. For sports, you can look for
sedin it (Perl).
- Perl was (among other things) inspired by the Unix shell (and C, which is very important to Unix -- or the other way around, perhaps).
- Also, Perl can be distributed under a GNU license. Some people would consider that irrelevant from a technical standpoint, but it shows the intermingling.
- The last thing I can think of is LAMP, which is a networking "software bundle". (Check it out on Wikipedia: the P is, or at least was, Perl; the L is Linux.) (But this last point is a bit "chicken or egg".)
I think the answer to this question is in part historic, in part practical.
As for the history, Perl is a classy language. It is more classy than Python (not to mention PHP), although I have no idea what is "better" (if that could somehow be formally analyzed, which I doubt). And the classy guys who are using (or used) Perl are typically the guys deciding what should be part of a Linux distro.
As for what is practical, Perl is still the glue of a lot of things: OSs and the web alike (again, LAMP, not forgetting either Python or PHP). So why not include anything that is useful for a lot of purposes? And even more so, why remove anything that is there (and doesn't cause any harm), and is useful?
But, as it happens, there is a note on this in the most recent issue of The Linux Magazine (#151, June 2013). Apparently, in order to compile the Linux kernel a couple of short and simple Perl scripts are employed. (Again, the "glue" role of Perl in OSs.) Now, one of the kernel developers has been submitting patches of a re-write of those scripts, this time not in Perl, but as "Unix shell scripts" (is that
sh?). That way, Perl would not have to be installed for anyone compiling the kernel. But, that patch (submitted several times) hasn't been picked up. And one reason for this is, once out in the cold, Perl is not likely to be let in. People like Perl, and they don't want to part with it.
Now, this only touches the fringes of this question as probably a very small minority of Linux users are likely to compile the kernel. But it is yet another piece of the puzzle (and I suspect there are many).