The "language" attribute of the "script" tag is deprecated, use the "type" attribute instead, typically with a value of "text/javascript".
XHTML requires lower case tag names, and using them also in HTML does not hurt.
The "meta" tag is only useful if you deliver the HTML content via a protocol that does not allow specifying a content type (file://, ftp://). In HTTP context, use the "Content-Type" HTTP header. In E-Mail context, use the "Content-Type" MIME header.
You say you use the CGI module. Read the documentation of its header() method.
The usage instructions for most Perl modules are embedded into the module, use http://search.cpan.org/ or the perldoc utility to read them.
Placing huge loads of javascript into a variable in a module may seem tempting, but consider placing the javascript into an external javascript file, and have the web server deliver it directly. Delivering content from a CGI script is SLOOOOOOOOOOOOOW.
Split the javascript code into a huge reusable part in the external file, and a small configurating part inside your delivered HTML.
Remember that (in a typical CGI environment) Perl code runs on the server side and Javascript code runs on the client side, after your Perl code has finished. If you want to mix both, you want to learn about AJAX and JSONRPC. That makes some things look better, but it creates lots of new problems. Try learning ordinary CGI first.
Alexander
--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)