in reply to calling perl function from HTML

Looks like you want some dynamic generated part of your page, this can be done using AJAX techniques (XMLHTTPRequest) like google suggest or google maps uses.
there is a free and simple (also perl based) library to try for this, have a look at Sajax.

"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.