in reply to Close your filehandle - a simple fix for a cgi script

Isn't it a nice feeling when you fix something like that;)

Using a lexical variable for the file handle also works.

if(open my $MAIL, "|/usr/lib/sendmail") { print $MAIL <<EOF; content of form EOF } else { print "error message"; }
The handle goes out of scope and is closed automatically.