I have this code:
#opening the logfile to check for logout
open (CHECKLOGOUT, "/$username/perl/lrnprl.log") || die "\nCouldn't open file to check for logout status\n";
#the code that checks the "end of file" (eof) for the character "#"
#and "if" the file ends with "#"
#it....
#1) clears the screen
#2) prints the exit message
#3) closes the filehandle
#4) exits the program.
if (eof("#")){
system ("cls");
print "\n\n\n\n\n\n\t\tEXITING PROGRAM IMMEDIATELY\n\n\n\t\t !!YOU MUST FIRST LOGOUT!!\n\n\n\n\n\n";
close (CHECKLOGOUT);
exit 0;
}
This will exit the program no matter what! I think I can do this with eof(). A friend showed me some code using seek() and read(). I want to use eof() because I'm stubborn. Any help is appreciated.
In reply to Reading the last character of a file and/or line. by providencia
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |