http://qs1969.pair.com?node_id=188810


in reply to Calling a sub-routine in CGI

You could try
print "<a href='".toggle_on()"'>ON</a>";
Without knowing what toggle_on does. Are you trying to access the subroutine via the web page link? If so, it is not so straightforward, as you have to get the name from a form submission. Then you could have a hash of subroutine references, and if the form submission is in your list, then run it. In which case a bit of code like:
print "<a href='$BASE_URL?action=toggle_on'>ON</a>";
will be what you want in your HTML, where $BASE_URL is set to the appropriate link for your script. I would suggest having a look at CGI.pm for an easy way to deal with form submissions. Hope that helps!