in reply to Re^8: need to remove the extra line in regular expression
in thread need to remove the extra line in regular expression

In this I am reading the complete file with file handle.
No, you read it line by line, and the code inside the while(){} loop gets run once for every line in the text you read.
But I am not able to check the condition on the first line.
Just don't touch the second check in any way. Modify the first check, not the whole loop.
Sorry if my advice was wrong.
  • Comment on Re^9: need to remove the extra line in regular expression