Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

eof

Tests whether the next read on a filehandle will return end-of-file.

Returns true (1) when the filehandle has reached end-of-file, or an empty string (false) otherwise. Called without arguments, eof() checks the filehandle most recently read via <> or readline.

If the filehandle is invalid or has never been read, returns true.

Synopsis

if (eof($fh))  { ... }   # test specific filehandle
if (eof())     { ... }   # test last-read filehandle
if (eof)       { ... }   # same as eof()

See Also

readline, read, tell