in reply to Merging Perl/JS

That, sorry, sounds stupid to me: The value submit button of a form depends on the results of the form itself?

You should rather look for a server-side-only method of organazing your information-flow.

You cannot "combine" Perl (on the Server-side) and JS (on the Client-side) as you want it. Both don't know of each other's existence at all and they can only communicate implicitly. JS can cause requests that invoke the server-sided program and that program can generate JS code, which again is executed on "the other side of the web".

I'm convinced there is a much better way of solving you particular problem using only Perl.

--
http://fruiture.de