Skip to content
sandbox-workers
Esc
navigateopen⌘Jpreview
On this page

Perl

Execute code with Perl 5.42.2 inside a dedicated Wasm Worker.

Package: @sandbox-workers/perl. Code is a script: the value of the last expression is the result. Env vars are available as %ENV, e.g. $ENV{NAME}. The wrapper uses JSON::PP for values and captures stdout. Includes a read-only standard library; CPAN installations and arbitrary native extensions are unavailable.

Deploy

Deploy to Cloudflare

Or, after npm publication:

pnpm dlx @sandbox-workers/cli init perl my-sandbox

See deployment setup and Service Bindings. The template requires a Paid plan and creates no public URL.

Example

Env vars:

{ "NAME": "world" }

Code:

my $name = $ENV{NAME} // "world";
print "Hello from Perl!\n";
+{message => "Hello, $name!", squares => [map { $_ * $_ } 0..5]};

Every request gets a fresh engine instance. State does not persist between executions. Consult limits for fuel, memory, and output budgets.

License notice

Before use or redistribution, review this runtime’s LICENSE and THIRD_PARTY_NOTICES.md. Bundled interpreters retain their upstream licenses. The package includes the applicable notices in its licenses/ directory.