How to tell if Perl is installed on your computer

Ovid on 2006-08-07T12:33:04

Every once in a while I find myself sitting up and thinking "why the hell did I just write that?" I still remember the time I needed a one-off to read the end of a logfile and keeping reading lines as they appeared, so I started to write some Perl code for that ...

After a couple of lines of realizing how stupid I was being, I very quietly deleted the code and hoped no one would notice. So today, I was quite amused to see I'm not the only one who does silly things. In a discussion of whether or not Perl was available on a particular Sun product, someone posted a handy shell script you can use to see if Perl is installed:

#!/bin/ksh
which perl
perl -V


Not if, where

djberg96 on 2006-08-07T19:10:42

If Perl isn't installed on a Sun product, that Sun product will likely not work properly. :-P

And don't even *think* about upgrading the default Perl installation on a Solaris box.

Re:Not if, where

Abigail on 2006-08-07T22:39:05

And don't even *think* about upgrading the default Perl installation on a Solaris box.

And rightly so. But unless many Linux distribution, Solaris doesn't mind at all if you install your own Perl build in /usr/bin/perl. See, on Solaris, /usr/bin/perl is just a link to the "default" Perl install of the Solaris box, and all system utilities use the real path, and not /usr/bin/perl. So, replacing /usr/bin/perl with your own build is all handy-dandy on Solaris. Which you cannot say of every other platform.