|
I'm a Perl noob, relatively speaking. I'm not familiar with the File::Compare module of which you speak, but I would solve the problem thusly:
1. Open both files.
2. Read in the first line of the inner file (the Chapter).
3. Scan through each line of the outer file (the Book) looking for the first line.
4. If you find a matching line, read each subsequent line in both files, for as long as they match.
5. If every line in the Chapter file is found in the Book file, you have your match.
6. Otherwise, if you hit a line in the Book file that does not match the corresponding line in the Chapter file, you don't have a match, so continue scanning the Book file for that first line of the Chapter file.
7. Go back to step 4 until there is you've matched the whole Chapter or you've reached EOF of the Book.
Hope this helps. . .
Mark
|