in reply to Re^2: Zipping Files Help!
in thread Zipping Files Help!

This version is trying to add a copy of 'log.txt' to the zip file each time the foreach loop iterates unless the file is already there. That means it adds it the first time and never again.

It seems like you would want to just print to log.txt inside the foreach loop. Then after the foreach loop, close 'log.txt' and then call $zip->addFile('log.txt') then call writeToFileNamed.

What is the purpose of the variable $zipped? You don't use it anywhere.

# do some clean up::: $files=~s/[\r\n]+//;

Is this intended to remove newlines? Why not use chomp?

What does the output from this program look like? Is it creating test.zip at all? Does it contain files?

I suggest you get rid of the 'show status' section at the end. If the program dies that won't run. And there is no use having the variable $flag.