Format REPORT = Test . Sub one { open(REPORT,">output.txt"); write(REPORT); #trying to send mail using this output.txt file open(FILE,"output.txt"); system("mailx -s \"Testing Report\" name@company.com<$FILE"); }