in reply to Add Javascript file and Javascript code using CGI.pm

Stop breaking your head. Give the documentation a chance! From CGI's Pod (modified for correct attributes)-

print $q->start_html(-title=>'The Riddle of the Sphinx', -script=>{-type=>'text/javascript', -src=>'/javascript/sphinx.js'} );

You can also just use HEREdocs to print scripts out without getting too messy. Templates are the way to go but I do this sort of thing for one-offs and standalones. Sometimes TT2 in a standalone with all the template code in the __DATA__ section.

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.