Just to be sure: CGI runs on server; "browser" JavaScript runs... well, on browser, i.e. on the client side. You can't just call the client's JavaScript from the server (but you may instruct the browser to do so, e.g. using <body onload="..."> event hooks).
Please, use search functions of Perlmonks on how to run JavaScript interpreter on the server side, there's a lot of it, e.g. javascript interpreter in perl???.
Comment on Re: how can i execute javascript in perl