As the monks said, CGI is for web development. it has a set of configurations to be set in the web server. CGI cannot be placed in any directories. The configurations are given in the following url,
Apache configuration for CGI
If you wish to read about perl CGI,
this will help you.