1. Technology

Testing your Perl installation

Testing Perl on Windows (ActivePerl)

By

The first thing you'll want to do is make sure you've followed the ActivePerl Installation tutorial and installed ActivePerl and the Perl Package Manager on your machine. Next, create a folder on your C: drive to store your scripts in - for the sake of the tutorial, we'll call this folder perlscripts. Copy the 'Hello World' program into C:\perlscripts\ and make sure the filename is hello.pl.

Now we need to get to a Windows command prompt. Do this by clicking on the Start menu and selecting the item Run.... This will pop up the run screen that contains the Open: line. From here, just type cmd into the Open: field and press the Enter key. This will open (yet another) window which is our Windows command prompt. You should see something like this:

 Microsoft Windows XP [Version 5.1.2600]
 (C) Copyright 1985-2001 Microsoft Corp.
 
 C:\Documents and Settings\perlguide\Desktop>
 
We need to change to the directory (cd) that contains our Perl scripts by typing in the following command:
 cd c:\perlscripts 
That should make our prompt reflect the change in path like so:
 C:\perlscripts> 
Now that we're in the same directory as the script, we can run it simply by typing it's name at the command prompt:
 hello.pl 
If Perl is installed and running correctly, it should output the phrase 'Hello World.', and then return you to the Windows command prompt.

An alternate method of testing your Perl installation is by running the interpreter itself with the -v flag:

 perl -v 
If the Perl interpreter is working correctly, this should output quite a bit of information, including the current version of Perl you are running.

To find out more about using the Windows command prompt, I would suggest reading this in-depth tutorial - Windows' Command Line Puts You in Control

  1. About.com
  2. Technology
  3. Perl
  4. Getting Started
  5. Testing Your Perl Installation - ActivePerl

©2014 About.com. All rights reserved.