Unfortunately, rewriting the code is out of the question.
So, I came up with the idea of creating a PHP wrapper for the Perl, letting the scripts do their thing, and then modifying the output with PHP before it gets sent to the browser. It's a pretty awful kludge, but I think it should work. The only way I know how to do this is in something similar to the following:
<?php system( "perl script.pl" ); ?>
This works fine as long as the script doesn't have any command line arguments, but most of the scripts pass global variables between each other and a database with CGI. Those variables are needed to figure out what HTML pieces are being shown in a given script, and we don't know what they are until the script begins to run.
Is there a way in PHP to interrupt the execution of the script so we can get these variables, and then continue with the PHP wrapper?