in reply to Email format issue

open MAIL,">/home/mfali/Workscripts/tmpfile.html" || die $!; ... open REPORT, "/home/mfali/public_html/my_report1/out.html" || die $!;

Your open statements will not die because the || (logical OR) operator has higher precedence than the , (comma) operator.

You need to either use parentheses for open:

open( MAIL,">/home/mfali/Workscripts/tmpfile.html" ) || die $!; ... open( REPORT, "/home/mfali/public_html/my_report1/out.html" ) || die $ +!;

Or use the lower precedence or operator:

open MAIL,">/home/mfali/Workscripts/tmpfile.html" or die $!; ... open REPORT, "/home/mfali/public_html/my_report1/out.html" or die $!;