sub mail_results { my $file = 'D:\Sysad-perl\scripts\Reports\AntiVirus Status\mailrpt.txt'; if ( -e $file ) { # # Mail the report. my $sender = new Mail::Sender {smtp => 'synplcty.synplicity.com', from => 'mshember@synplicity.com'}; $sender->MailFile({to => 'mshember@synplicity.com', subject => 'McAfee AVP Level Report', msg => "Here is today's report.", file => $file} ); } unlink $file or $! == 2 or die "Cannot unlink $file: $!"; } #### Cannot unlink D:\Sysad-perl\scripts\Reports\AntiVirus Status\mailrpt.txt: Permission denied at D:\Sysad-perl\scripts\Reports\AntiVirus Status\avpcheck.pl line 3 65.