in reply to Perl script shows source code

Do you get the HTML source or the source of the script itself?

If you get the HTML source, you must make sure you send the right content-type header. If you see the perl source code, probably either the script's file extension is wrong (or at least, your webserver doesn't recognize it as a cgi script) or your webserver does not have execute rights to the script.

Take a look at the server's error log.