Also, you'll need to change your script to print an appropriate response header and send your output to stdout, instead of to a file.
Also, to make your CGI script handle form variables, you may wish to use the following modules:
# Print a header and a blank line afterwards to indicate end of header
print "Content-type: text/html"
# Now print your HTML page
print " Hello World"
# The next two lines are useful, to print script errors to the browser