$date = strftime("%Y-%m-%d", localtime); mkdir my $foldername = "D:/log_script/Archive/$date"; my @cmd = 'D:/app/7-Zip/7z.exe', 'a', '-mx9', 'D:/log_script/Archive/target.zip', '$foldername/*.log' ); print 'about to execute: ', Dumper \@cmd; system @cmd;