in reply to Why isn't the file being produced?
As well as dragonchild's fine advice you should be checking the success of the opens that you are doing and printing the error message in $! if they fail.
/J\