/home/www/abc/logs gzip: /access_log: No such file or directory gzip: /error_log: No such file or directory /home/www/def/logs gzip: /access_log: No such file or directory gzip: /error_log: No such file or directory #### #!/usr/bin/perl -w use strict; use diagnostics; use MIME::Lite; #use a file glob in a for loop to search for marker file "weekly" # added braces and changed variable name for my $a () { substr($a,-7)=" "; print $a; #build a mail message with the access_log & error log files gzipp'ed #and attached my $msg = MIME::Lite->build( From => 'root@abc.xyz.com', To => 'john.doe@joesoap.org', Subject => "gzipp'ed log file", Type =>'x-gzip', Path =>"/usr/bin/gzip < $a/access_log |", ReadNow => 1, Filename =>"access_log.tgz"); $msg->send; my $msg2 = MIME::Lite->build( From => 'root@abc.xyz.com', To => 'john.doe@joesoap.org', Subject => "gzipp'ed log file", Type =>'x-gzip', Path =>"/usr/bin/gzip < $a/error_log |", ReadNow => 1, Filename =>"error_log.tgz"); $msg2->send; }