C programs can contain many exploitable bugs, as the net's experiences with NCSA httpd 1.3 and sendmail shows.Counterbalancing the problems with interpreted scripts is that they tend to be shorter and are therefore more easily understood by other people than the author.Furthermore, Perl contains a number of built-in features that were designed to catch potential security holes.For example, the taint checks (see below) catch many of the common pitfalls in CGI scripting, and may make Perl scripts safer in some respects than the equivalent C program. The best you can do is to examine it carefully and understand what it's doing and how it's doing it.
Even though a properly-configured server will not return the source code to an executable script, there are many scenarios in which this can be bypassed. For convenience's sake, you've decided to identify CGI scripts to the server using the extension.
The World Wide Web Consortium (W3C) hosts this document as a service to the Web Community; however, it does not endorse its contents.
Programs that read files may inadvertently violate access restrictions you've set up, or pass sensitive system information to hackers.
Programs that write files have the potential to modify or damage documents, or, in the worst case, introduce trojan horses to your system.
Another reason that compiled code may be safer than interpreted code is the size and complexity issue. A third consideration is that the scripting languages make it extremely easy to send data to system commands and capture their output.