in reply to Script in browser

this is really an http server config issue not really a coding issue.

Note that the following information very much "depends" (and this isn't the forum for discussing http server issues so I will be brief as well as incomplete...read your http server docs).

if the Perl file is in a directory defined as a cgi|shellcgi directory then it will be executed (this can "depend"). if you move this file to a non-cgi directory, then it also "depends" as to what will happen, often based on the extension. I find that on windows both NS and IE will ask you to either download the script or execute it using the windows mappings...i.e. if you have Perl installed on the local box, you may be prompted as to whether you desire the script to be run using Perl.exe. On unix, I find netscape will also want to "save as" the file locally.

if you truly want your scripts to be viewed as source by everyone regardless of their platform then perhaps as easy solution is to change/remove the extension, to be sure you could copy the scripts to a non-cgi directory and rename them to script.html or just script. if on unix, be sure these are not marked executable. This is a kluge, but will work.

as far as how the scripts get viewed as code here on perlmonks....the use of a custom tag pair, as documented Site How To