in reply to Perl not running Javascript

Your question really has nothing to do with Perl at all. However, I did notice that the script tag you are outputting is incorrect, so the browser is never even loading your javascript file to begin with.