January 2015 Archives

Kiss Kiss Shebang Shebang

At the end of the discussion, our sysadmin commented:

Perl sure does seem to need a lot of scaffolding these days before one can get around to the business purpose.

And my response was that Perl had always needed a lot of scaffolding.  It’s just that we never used to notice, because it was all built-in.

Pretty much every Perl tutorial is going to tell you that the first line of your first Perl script should look something like this:

#! /usr/bin/perl

Now, sure: it isn’t going to be that easy on Windows, or other non-Unixy systems, and even in the Unices there are going to be flavors where Perl is in /usr/local/bin or somesuch, but that line actually works on a significant majority of the potential cases.  And that’s all you have to do to make your Perl program work.  Perl is a compiled language, but you don’t have to compile your Perl code (which is why it’s commonly considered an interpreted language, even though it’s technically not).  Whenever you run your Perl code, it just magically compiles and runs, including finding all the executable bits and all the libraries and all the modules.  You don’t have to worry about compiling and linking, as you would with C++.  For that matter, you didn’t have to install Perl in the first place, as you might have to do with Python or Ruby.  Nope, everything—all the scaffolding—is just there.

About Buddy Burden

user-pic 8 years in California, 19 years in Perl, 28 years in computers, 48 years in bare feet.