open FILE2,'output.txt'; #### print() on closed filehandle FILE2 at ... #### open FILE, '<', 'testFile.txt'; ... open FILE2, '>', 'output.txt'; #### use autodie;