use IO::Tee; $OutFile = "/export/home/netbackup/logs/available.log"; $tee = new IO::Tee(\*STDOUT, new IO::File(">$OutFile")); print $tee "Line 1\n"; print $tee "Line 2\n"; Print $tee "Line3\n" ##################################################################### #### Emailing the Reports now ##################################################################### # Send An Email with Attachment MIME::Lite->send('smtp',"$Email_Server",Timeout=>60); $msg = MIME::Lite->new( From => 'Netbackup@company.net', To => "$Email_List", Subject => "$hostname} Available Media Report", Type => 'multipart/mixed'); $msg->attach(Type => 'application/vnd.ms-word', Filename => `basename \"${OutFile}\"`, Path => "$OutFile", ReadNow => 1, Disposition => 'attachment'); $msg->attach(Type => "text/plain", Encoding => 'base64', Data => $OutFile); $msg->send(); ##################################################################### #### End Emailing the Reports #####################################################################