here is how I do it and it works:
#!/usr/bin/perl
print "</BODY></HTML>";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
%FORM = ();
foreach $pair (@pairs) {
$pair =~ s/\+/ /g;
($name, $value) = split(/=/, $pair);
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("c", hex($1))/eg;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("c", hex($1))/eg;
$value =~ s/\n/ /g; # replace newlines with spaces
$value =~ s/\r//g; # remove hard returns
$value =~ s/\cM//g; # delete ^M's
$FORM{$name} = $value;
}
foreach $key (put your variable names in here that you are asking in your html program e.g. "name","address","city","state","email"

{
# to make sure that the variables are passed on to his program from your html keep this statement. It prints all the variable sent from HTML.
print "$key = $FORM{$key}<br>";
print "\n";
}
$mailprog ='/usr/lib/sendmail';
$sender =put your company email address here in quotes e.g. "sales\@company.com";
open (MAIL, "| $mailprog $FORM{'email'}"

or die "Could not open Mailprogram:";
print MAIL "TO: $FORM{'email'}\n";
print MAIL "FROM: $recipient\n";
print MAIL "Subject : Thanks\n";
print MAIL "You have provided this information:\n";
print MAIL "Name : $FORM{'name'}. address: $FORM{'address'} city: $FORM{'city'}\n";
print MAIL "$FORM{'state'} $FORM{'zip-code'}\n";
print MAIL "phone : $FORM{'telephone'} to call you between $FORM{'time-to-call'} \n";
close (MAIL);
print <<EndHTML;
EndHTML
sub dienice {
my($msg) = @_;
print "<h2>Error</h2>\n";
print $msg;
exit;
Save this as myform.cgi program and store it in the CGI directory of your server. Then add this statement in the HTML program:
<form method="post" name="myform" action="/cgi-bin/myform.cgi">
Good luck.