First, why not use eof to check for an end-of-file condition?
Second, a common way to handle this situation is to close the filehandle after readline returns undef, and see if the close fails. If it does, there was some kind of error handling the file.
In reply to Re^3: readline succeeds but sets $! = EBADF
by sgifford
in thread readline succeeds but sets $! = EBADF
by ambrus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |