I would check what your value of $log is. You may be making a logfile -- just not the one you're expecting. Also better clarity in your variable naming wouldn't hurt. $logname might be clearer than $log and avoid confusion with your @log array.
If you are still not creating a log file check the permissions on the directory into which it is trying to write. chdir may not be your cwd so your log may be printing somewhere you don't expect. ( Like where you are starting the script from )
One last suggestion would be to simplify the setting of the logfile name with 1 line $logname= "$log\.log"