Broken Pipe problems!

I'm now writing a simple perl program that is to retrieve data form data from the web and then mail the data to a person! but I faced a problems in the send mail part! Can anyone help to find out the problems?
My code:
open (MAIL, "|$/bin/lib/sendmail") || die "Can't open /bin/lib/sendmail!\n";

print MAIL ("To: $mailaddr\n");
print MAIL ("From: SunFlower Form Enquirer\n");
print MAIL ("Subject: Form Response\n\n");

close (MAIL);

#end of my code
The problem is that whenever I put
print MAIL ("XXXXX");
sentence inside between the
open (MAIL, "...") and close(MAIL)
ERROR messages prompt that "BROKEN PIPE"
but if I won't put print sentence inside that everything alright.. but also no mail is sent!
Who is Participating?
adam923Connect With a Mentor Commented:
get rid of the $ in the open line
All Courses

From novice to tech pro — start learning today.