in reply to system function adds spurious characters to log file

The first part looks like an ANSI control sequence. Maybe you have something like that in a shell related resource file that outputs this character sequence? Is there a wrapper or alias for tar in place?
Have a look at /etc/profile, ~/.profile, ~/.bashrc, ~/.cshrc, and the like. The $MAIL* environment variables are another potential cause of this problem.

Alternatively - more perlish - you could try to bypass the indirect shell invocation by using system in list contextwith an argument list. E.g., tar might support compression using switches like -j/-z/-Z (get rid of gzip invocation). See fork to run the command as a background process.
HTH

  • Comment on Re: system function adds spurious characters to log file