Perl: Installing It

Possessed of a name that stands for "Practical Extraction and Report Language" — or maybe not — Perl has expanded from its humble beginnings to let users perform a wide variety of tasks. Before you can use it to do any of those tasks, however, you must install it. That is the focus of this article, the first in a series that will teach you the basics of Perl programming.

It was a snowy winter, and Larry Wall sat huddled around his fireplace, sipping hot cocoa and listening to Poison’s, “Nothing but a Good Time.” The collars of his red leather imitation Michael Jackson jacket were no doubt standing straight on end, while the light from the flames glinted off the 4,000 totally unnecessary yet cool zippers on that same jacket. On his left hand he wore a white glove covered in Cheetoh dust; on the right…nothing at all.

It was nearing midnight, and something evil was lurking in the dark. Larry Wall heard the door slam and tried to scream, but terror gripped him beyond his imagination. Tee-hee. (Yes, those are the lyrics from MJ’s Thriller; if you didn’t know that, then go buy that album and listen to it until your hair turns into a greasy jerry-curled mess).

It is no little wonder then, that under those conditions, Larry Wall chose to name his new programming language after a biblical story: The Parable of Pearl (Gospel of Matthew for all you heathens out there). Maybe he thought doing so would scare off that evil thing lurking in the dark. Coincidentally, Michael Jackson was that scary thing.

He was also probably tired and delirious, seeing as how he reportedly read every three and four letter word from the dictionary trying to choose a name. Personally, if Michael Jackson was creeping around my pad after midnight, I could think of a bevy of four letter words I would have used.

But Wall had a solid head on his shoulders. He even thought about using his wife’s name, Gloria, but decided against it for two reasons: 1) He didn’t want four million nerds moaning his wife’s name into the wee hours of the morning, and 2) He had just written that hit song, “Gloria” and saw no need to.

So he chose Pearl. Then he discovered there was already a programming language called that, so he cursed a lot and changed it to Perl.

Whatever happened to Michael Jackson that night, the world will never know…

(Note: Perl is not a typo. Well it is, but an intentional one. And although some people believe PERL stands for “Practical Extraction and Report Language,” those people are wrong and have too much time on their hands).

{mospagebreak title=Installing Perl}

Perl started off as a language to make creating reports simpler. Since then it has grown in scope, allowing users to perform all manner of tasks, including web development, system administration, network programming, graphical user interface creation, and much, much more.

Before we learn to do any of that however, we must learn how to install it.

For Windows users, the simplest method is using ActivePerl (created by ActiveState). You can find it here: ActivePerl (you have to sign up as a member first). Scroll down to the Windows (x86) section and click on the MSI link. After downloading the file, double-click on it to install.


This will open the ActivePerl Setup Wizard. Click on the Next button to continue.




The next window will be ActivePerl’s EULA (End-User License Agreement). If you accept the terms of the agreement, choose that option and click the Next button. If not, then quit reading this tutorial, stand up, bend at the waist, and run head first into the nearest wall.




Next, you will be allowed to customize your setup. You can do so, or just use the default settings. If you want to see how much space the program will take and how much you have available (and in total for that matter), click the Disk Usage button. When you are finished goofing around, go ahead and click the good old Next button again.





Again you will be taken to an Optional Setup window. Leave everything at its default value and click Next.

Finally, click the Install button. The setup wizard will start installing files and wrecking up the place, turning over tables and smashing lamps. Go ahead and let it run wild. After the Setup Wizard gets tired, you will see a window telling you that ActivePerl is finished setting up. Click the Finish button and you are all set.

{mospagebreak title=But How Do I Know it Installed Properly?}

That’s a good question. Let’s test it out.

Go to your C: Drive and create a folder called PerlPrograms. Then open up a notepad file and enter the following code:


#!/usr/bin/perl

print “James Payne is my Lord and Master!n”;

Don’t worry about what the code means right now; we’ll cover that in a later tutorial. For now, just save the file with the filename test.pl. Copy it over to the PerlPrograms folder we just created.

The next step is to open the Windows Command Prompt. Go to Start>Run, type cmd and click the OK button.




At the prompt, type in the following to change to the current directory to the directory where your script file is located:


cd   c:PerlPrograms  

Since the directory is now changed, we can simply type in the name of the file to have it run. In our case:


test.pl

If we set up Perl properly, you should see the text: “James Payne is my Lord and Master!”

You can also bypass all of that and simply type: perl -v at the command prompt and the current version of Perl will appear on the screen.

{mospagebreak title=Unix and Linux and Mac Oh My!}

For users of those systems, it’s time to wail and lament; I’m not comfortable explaining the installation process for those systems. I will say however that on most Unix/Linux systems out there, Perl comes pre-installed.

If you’re unlucky enough to have a version on which Perl is not pre-installed, don’t panic. There are plenty of examples of how to install it on those platforms (Google is your friend; go forth and search). Since I do not normally work in those environments, I’ll leave those explanations to the pros.

In Closing

That’s it for this tutorial. In my next tutorial, I will cover the basics of Perl programming and by the end of the series delve into dynamic web development with Perl.

Till then…

[gp-comments width="770" linklove="off" ]
antalya escort bayan antalya escort bayan