Or run your Perl programs in a Web server, and write a PHP HTTP client for them (fopen, curl).
I did that once and it works very well - POST and GET values can be passed on as is and the testing can be done on the server with Perl while completely ignoring the one with PHP ( Server A ).
The only downsides are:
Cross domain scripts sometimes give the user a scary error
The browser will render nothing until the entire HTML is thrown out which might make page loads appear slow to the user - You cant flush STDOUT halfway to get the browser to start rendering stuff.