in reply to Piping output into a log file

You could also try:
system($command . ' >> ' . $someFile);
You don't need to open $logFile thts way, unless you need $logFile further on in the program for some reason.