Web browser displays source code
When you visit the CGI script with your web browser, you may see the source code for the script, rather than the script output.
If this happens, there is one and only one explanation: it means your web server has not been configured to execute CGI scripts in that folder and/or with that file extension.
To solve the problem, you may need to:
Try a different file extension. Try both ".pl" and ".cgi".
Put your script in a different folder, like the "cgi-bin" or "cgi-local" folder.
If these tactics don't work, then probably your web server simply does not support CGI scripts at all. In that case, you should get an account on a CGI-enabled web hosting provider.
"Web browser displays source code" https://www.xav.com/scripts/search/help/1089.html