The Task

In Windows, if you have a perl script and want to distribute it to others, you need to ask the users to install Perl runtime.

In most cases, it would be great to avoid it by creating a single all-sufficient executable file.

Additionally, that would hide the script code and would allow to embed all the dependencies (libraries, text, database files, etc.) in a single file.

You can download the sample from GitHub.

The most popular Perl Runtime is ActivePerl. Please note that you need to use the 32-bit version of the runtime to be able to run the final exe in any Windows.

The script we are going to pack is quite simple. It shows the text from the external file hello.txt (this file will be embedded as well):

use strict;
use warnings;
my $filename = 'hello.txt';
open(my $fh, $filename) or die "Could not open file '$filename' $!";
while (my $row = <$fh>)
    chomp $row;
    print "$row\n";

Prepare the package

First of all, you need ActivePerl runtime; you can download it from the official website.

Important! Runtime files bitness: 32-bit vs. 64-bit.

Download the 32-bit version of the runtime to ensure the output exe will run well on both 32-bit and 64-bit Windows.

Using the 64-bit runtime files, the packer will produce a 64-bit executable. It won't run on 32-bit Windows.

At the same time, if you use 32-bit runtime files, the 32-bit executable will be produced, which can run on both 32-bit and 64-bit Windows.

Download BoxedApp Packer, launch it.

To run the perl script, type:

> perl.exe
Let's override the command line for the packed exe to be able to run perl.exe with without passing additional arguments. Click "Override command line" and then enter:
<BoxedAppVar:OldCmdLine> "<ExeDir>\"
The packed exe will run as if was really passed.

The script is being executed by perl.exe (find it in <Perl installation directory>\bin), so add it as the input file.

Then switch to Application Directory and add perl520.dll (again, find it in <Perl installation directory>\bin), because perl.exe requires it.

As the script uses two modules – strict and warnings – also add and (find them in <Perl installation directory>\lib).

And, finally, add the script file and the text file hello.txt.

The important option you need to check in order to properly build the output exe is "Run packed exe in virtual environment". Check it.

Build it and run. It shows the text as expected!


1. Select perl.exe
Select perl.exe
2. Set output name
Set output name
3. Override command line
Override command line
4. Run in virtual environment
Run in virtual environment
5. Add files
Add files
6. Build and run. It works!
Packed perl script


Both sources and BoxedApp Packer project are available on GitHub.