using Perl from HTML is not recommended
I'm curious why that is.
Here is a method that works fine on my test server for a similar type of thing. I was going to suggest it to the OP, but it's rather involved, perhaps more than they wanted to deal with. Is there a reason not to do it this way?
The web page is an .html file that has PHP code in it, with the server properly configured to run the PHP code.
The page contains an HTML form that posts to the same page:
<form method="post" action="">
A block of PHP code in the page tests whether there was any form data submitted.
If there was no form data, the page is just rendered normally, without trying to process or put on the page form data that doesn't exist.
However, if there was form data submitted, PHP code sanitizes and validates it, then passes the submitted data to a Perl script:
$cmd = escapeshellcmd('perl -wT ' . escapeshellarg("path/to/my/script.pl") . 'various args');
$output = shell_exec($cmd);
$output contains whatever text the Perl script generated, which PHP then puts on the .html page at the needed location.
It seems to me the advantage is that it uses PHP for what it is good at: being embedded in the page to easily generate HTML code where it's needed, while Perl is used for the heavy text processing where speed is required, but not used for actually generating the HTML page, which (at least from my standpoint of Perl inexperience) is sort of cumbersome.