14

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+

Red
  • 164
  • 6
  • 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 '20 at 12:06
  • 1
    I believe AIX does not actually install Perl by default. Are you sure it does? – terdon Feb 17 '20 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 '20 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 '20 at 15:01
  • I don't know either. I just have been told (in a comment on this site, at some point) that AIX won't install Perl by default. It's there, and easy to install, but not included by default. – terdon Feb 17 '20 at 15:05
  • 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 '20 at 16:40
  • 1
    My phone. $ perl: /system/bin/sh: inaccessible or not found – Joshua Feb 17 '20 at 22:48
  • @JeffSchaller thank you, great info – Red Feb 18 '20 at 06:46
  • Encouraging developers to use any particular programming language just for that language's sake feels a bit strange, especially if it's just so that you (singular) may "avoid dealing with the hassle of various dialects" of the other tools. Also, don't you know what operating systems are used in your team?? – Kusalananda Feb 18 '20 at 07:01
  • 1
    @Kusalananda, I know what OSes are used in my team, but people move on, and I would like to prepare them for the future, especialy since they are mostly juniors/interns. – Red Feb 18 '20 at 07:07
  • @Kusalananda, I have several objective reasons to consider perl, but they are not in the scope of the question, that note was just o justify why the "duplicate" doesn't answer it. – Red Feb 18 '20 at 07:09
  • @Red To prepare people for the future, you teach them how to use a multitude of tools. You don't give them a single tool that may be obsolete in half a decade. If the duplicate does not answer the question, then I'd be more than willing to close the question as unclear instead, or as opinion-based. – Kusalananda Feb 18 '20 at 07:15
  • @Kusalananda, sorry dude, I don't know why you are trying to bait me into a flame war, but I'm not interested. No need for you to be so aggressive!.Grab a coffee and chill! If your goal is to close this question, congrats, you did it. Good luck! – Red Feb 18 '20 at 07:20
  • 1
    If the people of your team are using implementation-specific features of sed/awk/grep/etc... then I would say that it makes sense to use an other tool that integrate all of it and that doesn't depend on the platform it's running on. – Fravadona Sep 13 '22 at 11:33

4 Answers4

14

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

JdeBP
  • 68,745
  • 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 '20 at 14:34
8

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.

Ole Tange
  • 35,514
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.

Zombo
  • 1
  • 5
  • 44
  • 63
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.

vonbrand
  • 18,253
  • 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 '20 at 06: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 '20 at 06:52
  • 2
    @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). –  Feb 19 '20 at 06:01