in reply to Re^3: Read the last line in a text file
in thread Read the last line in a text file

This is the other way round I'm trying to solve my problem for my prior question. As you have said chomp, can you please let me know where exactly I have to use the chomp in the above code? (as a novice in perl)
  • Comment on Re^4: Read the last line in a text file

Replies are listed 'Best First'.
Re^5: Read the last line in a text file
by ww (Archbishop) on Aug 22, 2008 at 12:35 UTC

    Did you trying using your own resources to find the answer?

    perldoc -f chomp

    You'll find the documentation that came with your installation will help you learn.

Re^5: Read the last line in a text file
by moritz (Cardinal) on Aug 22, 2008 at 12:34 UTC
    Well, it's not so hard. At some point you read the line, where it still has the newline. Later you use that line in a comparison, at which point it shouldn't have the newline any more. So where do you need to remove it?

    Also don't be afraid to just try stuff. It really helps.