Skip to main content
Perl

Installing the Perl Interpreter on Windows and Customize Notepad++

By November 29, 2014September 12th, 2022No Comments

The Perl Interpreter on Windows

Of course if you are learning Perl on Linux it is usually included in the OS and does not need to be added by yourself but, if you would like to try it on Windows then you are going to need to install the program. You have a choice of Strawberry Perl and Active Perl, this is a personal choice and should not make a whole heap of difference. In the demonstration we install Strawberry Perl and configure Notepad ++ so that it can run Perl scripts from inside the editor program.

The installation program can be install from strawberryperl.com and once downloaded the MSI installer is a simple process to install. Once installed from the command line prompt we can type the command :

perl -v

To verify the program works and displays the version of perl. We have installed version 5.20.1.

The run a perl program we can execute it direct from the command line where the code is not long:

perl -e "print 'Hello';"

This will print the word hello to the screen. More complex code will be written and preserved into a script with a text editor and then run as similar to this:

perl c:\temp\test.pl

However, if we choose the use the popular and free Notepad++ text editor we can add a plugin that will allow us to run Perl code from within the editor itself.

Firtst we need to start Notepadd++ and from the Plugins Menu Select Plugin Manager. From there we need to install the NppExec plugin. Once restarted we can return the the Plugin Menu and this time select NppExec > Execute and add a script.

NPP_SAVE
cd "$(CURRENT_DIRECTORY)"
C:\strawberryperl\bin\perl "$(FILE_NAME)"

Save this and name it Run Perl

From Plugin > NppExec > Advance Options We can choose to add this script to the Macron Menu.

 

Once restarted we can then create a Perl Script in he editor and run it directly without the need of the command line.