11

As far as I know, every desktop/server distribution of Linux has Perl (and core modules) installed by default, AIX and Solaris (IIRC) also do.

By "by default" I mean that even the most lightweight variant has it.

I haven't worked on BSD or similar ones, do they come with Perl?

Motivation: I'm trying to figure out if encouraging people in my team to use Perl instead of awk/sed/other text utils would make sense.

Note: Which is the most portable of sed, awk, perl and sh? does't answer my question. Portability it's not my main concern here, availability out of the box is. Even if all unix-like systems have awk/sed I would still prefer Perl.

Note: also, by Perl I mean Perl 5.8+

  • 5
    Definitely not every - OpenWRT doesn't have it installed by default for example. You can count on Perl being installed in all desktop and server systems though, I'd say. – Arkadiusz Drabczyk Feb 17 at 12:06
  • 1
    I believe AIX does not actually install Perl by default. Are you sure it does? – terdon Feb 17 at 12:28
  • 2
    On FreeBSD, I don't recall if it's installed but it's used by many ports for makefiles and regex. If you want an installation without perl, it's easy to uninstall it. – Rob Feb 17 at 12:43
  • 1
    @terdon I haven't seen one without it, and many deployment scripts where I work assume it's there by default. However, I don't know for sure, I never installed one from scratch. – Red Feb 17 at 15:01
  • 3
    supported versions of AIX come with perl, and this appears to have started by AIX 5.2: "The perl.rte fileset is on the first AIX CD and is automatically installed when installing 5.2 or when migrating from a previous level of AIX (e.g. 4.3)." – Jeff Schaller Feb 17 at 16:40
13

Yes, if you mean available as an ordinary third-party application rather than being bundled as part of the operating system.

FreeBSD dropped Perl from contrib back in 2003, in version 5.0. It's in ports/packages, of course.

This is also the case for NetBSD and MirBSD (a.k.a. MirOS BSD), for FreeBSD derivatives such as GhostBSD and TrueOS, and for FreeBSD fork DragonFlyBSD. FreeBSD fork MidnightBSD has retained Perl in contrib, however.

Further reading

  • 2
    Similarly, Perl is available through a package on NetBSD. It's in the base system on OpenBSD though, as the package tools are written in Perl there. – Kusalananda Feb 17 at 14:34
6

Cygwin:

https://cygwin.com

Does not include Perl in the Base install. It does have a Perl package available in the official mirrors. As you may suspect many packages pull it in as a requirement, like Git.

6

Having worked with both sed and awk I can say I breathed a sigh of relief when going to perl. sed and awk is fine for one-liners, but as soon as it gets a bit more complex I will turn to perl due to better error handling and a more powerful language. With perl I also avoid having to deal with different dialects of awk.

The only systems I have met in practice that did not have perl installed was my router and my Android phone (and it was trivially easy to install perl on those). Even all *BSD machines I have been on had perl installed. So while some BSDs may not have perl as part of the base system, all the system I have met in used in real life had perl installed - possibly because they had packages installed that depended on perl.

0

Plenty. Perl is standard fare on Linux systems, but it started out as a sort of "collection of Unix tools in script form for Unix users stranded in foreign lands". Very definitely non standard (I remember getting Perl 2.026 or some such number as 26 --the minor number was the number of patches, thus 26 as it was 26 files, one round of patches later it might be 31-- posts from the Usenet group comp.sources.unix around 1990). If you look at the official Unix definition, you won't find Perl (or Python, or Ruby, or PHP for that matter) mentioned at all.

  • 4
    There's no need to standardize perl (or python, ruby... etc) because there's only one perl implementation. That's the main reason it's not in the Unix standard. My experience is that perl is ubiquitous (on non-embedded systems) and while on GNU/Linux, you can use GNU tools, on non-GNU systems where the basic utilities are very limited, your best bet is to fall back to perl. It's much easier to write a portable perl script (even if you have to be compatible to 10 year old versions) than a portable shell scripts IMO. – Stéphane Chazelas Feb 18 at 6:29
  • Perl (5.8) has been basically the same since 2002 (probably earlier, but I haven't worked with earlier versions to much). – Red Feb 18 at 6:52
  • 1
    @Red there are a lot of gratuitous incompatibities with older versions of perl, which were introduced for no other reason than some maintainer feeling like they had to leave an indelible mark by "evolving" the language ;-). An example which bit me was changing split to no longer populate the @_ array when used in scalar context (that happened around 5.9 / 2003-2004). – mosvy Feb 19 at 6:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.