in reply to Mail script + HTML form

when I run it through the debugger it works fine...
From root@xxx.xxx.com Tue Apr 26 11:59:59 2005 Date: Tue, 26 Apr 2005 11:59:51 -0400 From: root <root@xxx.xxx.com> To: root@xxx.xxx.com Subject: Form Submission hello
but when I run it with
use warnings; use strict;
I get the following
Content-Type: text/html; charset=ISO-8859-1 Use of uninitialized value in concatenation (.) or string at testit.cg +i line 26.
line 26 is
print MAIL "$comments\n";
some thoughts
mabey an if ( defined ($comments) ) then make sure comments are being entered. Also you may want to use the following:
#!/usr/bin/perl -T use warnings; use strict;


Ted

--
"Men have become the tools of their tools."
  --Henry David Thoreau

Replies are listed 'Best First'.
Re^2: Mail script + HTML form
by Anonymous Monk on Apr 26, 2005 at 16:45 UTC
    No, comments can be omitted, not required. Just collect data from the form and send it to my email. I tried to use simple and small cgi script.
    How looks this:
    #!/usr/bin/perl -T use warnings; use strict; use CGI; # Create the CGI object my $query = new CGI; # Output the HTTP header print $query->header ( ); # Capture the form results my $email_address = $query->param("email_address"); # Email the form results open ( MAIL, "| /usr/lib/sendmail -t" ); print MAIL "From: $tracker\n"; print MAIL "To: portsmut\@navigator.com\n"; print MAIL "Subject: Form Submission\n\n"; print MAIL "\n.\n"; close ( MAIL );