When using perl it's best to let the script do the work. I'd take your form and get rid of the extra hidden values. If the script is failing it will most likely be a syntax error. In order to filter that out try letting perl do the job it was meant too
Code:
<form action="/cgi-bin/formmail.pl" method="POST">
<input type="text" name="recipient" value="">
<input type="text" name="subject" value="">
Next let perl handle all of the data.
Code:
#!/usr/bin/perl
use strict;
print "Content-type: text/html\n\n";
my($recipient) = "$FORM{recipient}";
my($subject) = "$FORM{subject}:'
# Check to see that all fields are filled out.
my(@required) = ("$recipient", "$subject");
foreach my $i(@required) {
if ($i eq "") {
print "You must fill in $i. Press back in your browser to try again.";
exit;
}
# Handle data if passed.
my($redirect) = "thankyou.html";
print redirect('$redirect');
Once your post information is good to post the information where you want it to go, perl will handle everything in between. Once the data matches on both forms they will work. character like @, if they aren't handled correctly will usually kick a syntax error, which is why we let perl handle them.