Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL eof Function
Syntax
Definition and Usage
Returns 1 if the next read on FILEHANDLE will return end of file, or if FILEHANDLE is not open.
An eof without an argument uses the last file read. Using eof() with empty parentheses is very different. It refers to the pseudo file formed from the files listed on the command line and accessed via the <> operator.
Return Value
Example
Following are the usage...
# insert dashes just before last line of last file
while (<>) {
if (eof()) { # check for end of last file
print "--------------\n";
}
print;
last if eof(); # needed if we're reading from a terminal
}
|
|

|
|
|