logging - How do I find if it is the last line while reading a file from within a loop in perl -


I am working on a log parsing script via Perl. I am reading the log file as follows:

  open (longfell, "$ logfile") || $ LogFile to open the "Error" error log file \ n "; While (& lt; LOGFILE & gt;) {# Processing statement goes here}  

Now in the processing statement I want to know whether the file reading indicator is on the last line or not . If so, before proceeding, there is a condition to be processed.

So the question is from within the loop which is being used to read the file line from the line, how will I know that it is on the last line?

  my $ last; While (& lt; MYFILE & gt;) {$ last = $ _ if eof; }  

Although you are doing something with every other line, it is very incompetent.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -