It's such an obvious point that no sibling monk has yet mentioned it, but if you put
at the top of your script you'll get lots of useful diagnostic info, and be prevented from doing anything really dim. See Use strict warnings and diagnostics or die
for more info.
My other thought is that perhaps something is going wrong in your relationship with sendmail. The best way to side step any such problems would be to use a module designed to ease that relationship. I've always had good fortune with Mail::Sendmail
§ George Sherston