I suggest that you put JavaScript into separate ".js" files and include them by means of an emitted <script> tag. Otherwise, put 'em in a template file. Don't muddy-up your Perl source code with them.
Comment on Re: How to get run jquery in cgi program?