CGI scripts must have the extension .cgi or .pl (e.g.. counter.cgi), and could be located anywhere within your document root /htdocs. The extension indicates the scripts as executable. No addition chmod is required. In addition, the common first lines like #!/usr/local/bin/perl or #!/usr/bin/perl are not necessary either. To have your own /cgi-bin/ directory, simply create one ( /htdocs/cgi-bin ).
Accept sendmail there are no other executables in the hosting account root directory, so subshells or commands like system or exec do not work.
Sendmail is located at /bin/sendmail, and will be called in the usual way:
open(MAIL, '|/bin/sendmail");
Please note, that the mail header
(the lines To:, From:, Subject: etc.) must be seperated from the message body by a blank line.
print MAIL 'To: you@yourdomain.com\n';
print MAIL 'From: me@mydomain.com\n';
print MAIL 'Subject: A subject\n';
print MAIL '\n';
print MAIL 'A message from me to you.\n';
close(MAIL);
For more information consult the Perl Man Pages.