in reply to How to get CGI form to also open another window (was "CatsPaw")

Not a Perl problem, but the simple solution to the JS problem is to remove the function definition so the window.open method executes inline:
print <<END_JS; <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> var url = 'http://perlmonks.com/' var mywin = window.open(url,"win","toolbar=0,location=0,directories= +0,status=0,menubar=0,scrollbars=0,resizable=0,width=520,height=350") </SCRIPT> END_JS
You might want to check out Here document formatting