Start debugging. Find out if the javascript is run each time (add an alert("foo") or so), find out if the perl routine is running (add a warn "foo" and look into the error log file). Once you've answered these two questions, you know where to search.