Perl on Windows

Perl does not come pre-installed with Windows. To work with Perl programs on Windows, Perl will need to be manually downloaded and installed. ActiveState offers a complete, ready-to-install version of Perl for Windows.

Click on the appropriate download link. You can leave the registration form blank and just hit continue to proceed. Download the windows msi installer. Run the installer. The areas of interest in the installer are the install location. If you are only running Perl on Windows machines, you can use the default location. If you also have Perl programs running on Linux or Mac OS X, you may want to change the install location to C:\usr. This will allow you to maintain portability in your programs. You can also check the box so that Perl gets added to the path, and check the box to create the perl file extension association. After the installer completes, you now have Perl on your machine.

Perl programs can be created using any text editor such as EditRocket. Perl programs and scripts typically end with the .pl extension. EditRocket will automatically recognize files with the .pl extension as Perl programs, and will color the syntax accordingly.

To create a Perl program, simply create a new file, such as In the file, place the following:

print "Hello World!";

Notice the first line of the file. Perl scripts should start with the path to Perl on the first line. The path to Perl should be the location where you installed Perl on your Windows machine.

The above script can be executed using the EditRocket Tools -> Perl -> Execute Program option, or you can execute it from a command prompt. To execute the script in the command prompt, use the cd command to cd to the directory where the file was saved, such as

cd C:\scripts

If when installing Perl, you selected the option for Perl to be added to the path, type the following:


Hello World! should then be printed to the screen.

If Perl is not in your Path, you will need to type the full location of the perl executable to run the program, such as C:\Perl\bin\perl

For more information about runing Perl programs via a local Windows Apache web server, see the following:

Running Perl with the Apache Web Server on Windows