All the lines will end in a new line. But you're seeding @comp with a string that doesn't have a newline. So, on the first run, the only way you get a match if your file contains 4 characters: s, e, e and d, and no newline.
Comment on Re: my code works just fine, but how :D