Situation1: when I tried to associate with the write function another filehandle than STDOUT to make it write the report to a file it tells me the filehandle isn't defined, uncomment the lines 32 and 33 to see that.