How to install Perl on a Windows machine....
To run Perl on Windows, you need to follow these steps:
Install Perl:
Windows does not come with Perl pre-installed. You need to download and install a Perl distribution for Windows.
Strawberry Perl: is a popular and recommended choice, as it's 100% open source and includes many commonly used modules. You can download it from the official Perl website or the Strawberry Perl website.
ActiveState Perl: is another option, offering both a free community edition and commercially supported versions.
Verify Installation (Optional but Recommended):
Open a Command Prompt or PowerShell.
Type perl -v and press Enter. You should see output indicating the installed Perl version.
Write Your Perl Script:
Create a new text file and save it with a .pl extension (e.g., myscript.pl).
Add your Perl code to this file. For example:
Code
#!/usr/bin/perl
print "Hello from Perl on Windows!\n";
(Note: The #!/usr/bin/perl line is a shebang and is primarily for Unix-like systems, but it's good practice to include it.)
Run Your Perl Script:
Open a Command Prompt or PowerShell.
Navigate to the directory where you saved your .pl file using the cd command (e.g., cd C:\MyScripts).
Execute the script using the perl interpreter:
Code
perl myscript.pl
If you have associated the .pl extension with Perl during installation, you might also be able to run it directly by typing myscript.pl and pressing Enter, without explicitly calling perl first.
Important Considerations:
PATH Environment Variable: Ensure that the directory containing perl.exe is included in your system's PATH environment variable. This allows you to run perl commands from any directory in the command prompt. Strawberry Perl typically handles this during installation.
Perl Modules: If your script requires external Perl modules, you can install them using the cpanm tool (included with Strawberry Perl) or CPAN. For example, to install a module named Some::Module:
Code
cpanm Some::Module
Strawberry Perl appears to be more "Unix Like" than ActiveState Perl. ActiveState Perl also has free vs. commercial versions.
Strawberry Perl handles downloading modules from CPAN easier.
Download Perl from here: https://www.perl.org/get.html From that page, in the Windows section, it is possible to select either Strawberry or ActiveState.
From the web site, you download a tiny "MSI" (installer?). When running this - Windows attempts to disable the operation (ha!). Select "more info", and tell F***'ing Windows to run it anyway!
NOTE: Stawberry Perl can only be installed to the hard drive - it can't be installed to a flash drive (bummer!).
To add a folder to the PATH environment variable on Windows, search for and open "Edit the system environment variables", then click "Environment Variables", select "Path" in the System variables section, click "Edit", and then click "New" to add your desired folder path. Click OK on all open windows and restart any Command Prompt windows to apply the changes.
Downloaded Strawberry Perl Portable from https://strawberryperl.com/releases.html
I chose the 64 bit 5.38.2.2 version. The zip file was downloaded from the above web site, copied to a flash drive, and all files extracted. It's a pretty big file (260G), and generates a large area...
To run the Portable version:
Search the extracted directory for the portableshell.bat file. Run the portableshell.bat file to set up env variables on the laptop.
Then the user should be able to run "perl <my_script>" from any directory within that shell.
IMPORTANT - will need to run portableshell.bat in any new shell / setup (??). May just need to run once per reboot? Maybe in each shell?