Javascript: clientside (in your web browser)
Perl: serverside (on the webserver)
The only way you are going to get anything like an on click is to use an anchor and link to a cgi directly:
<a href="program.cgi">Click here</a>
or (untested but would only work on IE)
<img src="blah.gif" onClick="self.location=program.cgi">
But you
really want to avoid the latter example.