eof FILEHANDLE
eof ()
eof Returns 1 if the next read on FILEHANDLE will
return end of file, or if FILEHANDLE is not open.
FILEHANDLE may be an expression whose value gives
the real filehandle. (Note that this function
actually reads a character and then "ungetc"s it,
so isn't very useful in an interactive context.)
Do not read from a terminal file (or call
"eof(FILEHANDLE)" on it) after end-of-file is
reached. File types such as terminals may lose
the end-of-file condition if you do.
####
Practical hint: you almost never need to use "eof"
in Perl, because the input operators typically
return "undef" when they run out of data, or if
there was an error.
##
##
while () {
print;
print "***\n";
}
##
##
while () {
print $_, "***\n";
}