First try seek(GWFILE, 0, 1); The statement "seek(GWFILE, 0, 1)" doesn't change the current position, but it does clear the end-of-file condition on the handle, so that the next makes Perl try again to read something.