Page 1 of 1

Installing Perl on Windows Rate Topic: -----

#1 jumptrooper  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 68
  • View blog
  • Posts: 234
  • Joined: 19-August 10

Posted 07 February 2011 - 11:44 AM

If you work on a Mac or use Linux, Perl comes as a built in feature of your OS. Windows users have to put out a little extra effort and download Perl. There are a few different ways to go about this, but this tutorial will walk through the installation process of Strawberry Perl.

If you're interested to know what separates Strawberry Perl from other distributions, such as ActivePerl, this article may be of use.

Installing Strawberry Perl


Step 1
Head on over to http://strawberryperl.com and download the latest version.

Step 2
Execute the installer by double clicking on .msi file (Ex. strawberry-perl-5.12.1.0.msi) and follow the setup wizard.

Step 3
By default, the installer creates the C:\strawberry directory and extracts all of its contents there. Installing Perl elsewhere is fine, but the README warns that whatever path you decide to install into needs to have directory names free of spaces. (i.e. "C:\blah\perl\bin\" is good, but "C:\blah blah\perl\bin\" is bad)

Step 4
Fire up the command prompt by going to Start > Run and typing "cmd" in the Run dialog.
Next, change directories over to the directory in which Perl was installed...
cd C:\strawberry
... and run the following two commands:
perl\bin\perl.exe relocation.pl.bat
perl\bin\perl.exe update_env.pl.bat
Alternately, you can use perl\bin\perl.exe update_env.pl.bat --nosystem if you want Perl to be available only for the current user.

Step 5
Time to test things out!
type perl -v, hit enter and hopefully bask in the glory of the version info!!

Step 6
To create an association between the ".pl" file extension and Strawberry Perl do the following:
1) Open Notepad and copy in the following code:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.pl\shell\open\Command]
@="\"C:\\strawberry\\perl\\bin\\perl.exe\" \"%1\" %*"


2) Save the file to the Desktop with a ".reg" extension.
3) Double click on it to make it apply the appropriate changes to the Registry. (We do it this way instead of manually modifying the Registry to avoid typos or accidentally modifying incorrect fields)

Step 7
Create a test script!
In Notepad, type up the following:
print "Hello, World!\n";


save the file as "script.pl" and in the command prompt cd to the directory in which it was saved. Type perl script.pl and hopefully you should see "Hello, World!" on the screen.

Of course, now that we have the ".pl" file extension associated with Perl files we can insert
#C:\strawberry\perl\bin\perl.exe
as the first line of the script and simply execute the script by typing script.pl in the command line (as opposed to perl script.pl), making that test script look like this:
#C:\strawberry\perl\bin\perl.exe
print "Hello, World!\n";




Congratulations! You've got Perl on Windows!

This post has been edited by jumptrooper: 07 February 2011 - 12:53 PM


Is This A Good Question/Topic? 2
  • +

Replies To: Installing Perl on Windows

#2 possnfiffer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 09-April 11

Posted 26 April 2011 - 11:44 AM

Excellent Post Worked Perfectly Thank You
Was This Post Helpful? 0
  • +
  • -

#3 alexr1090  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 38
  • View blog
  • Posts: 108
  • Joined: 08-May 11

Posted 24 June 2011 - 09:56 PM

I like that you used strawberry perl in your example :smile2:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1