in reply to call subroutine from cgi form

Pass a parameter in the request portion of the action attribute, and check for that parameter in the program:

<form action="my_prog.cgi?action=some_action">