in reply to Re^2: Filehandle opened only for output error
in thread Filehandle opened only for output error

According to what you showed us, you never print out anything. You don't even call the function to read the file!
  • Comment on Re^3: Filehandle opened only for output error