in reply to Re^3: Appending and empty files
in thread Appending and empty files

You don't need system to clobber temp, open my($fh), '>', 'temp' will clobber temp, which means your problem is your program logic and/or input data

Meaning, the open statement (after the first one) which is supposed to clobber temp is never executed