![]() |
|
Think about Loose Coupling | |
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
In order to reproduce your symptoms, if one of the START tokens doesn't start in column 1 (right at the beginning of the line), then then it wouldn't be recognized and that record would be skipped.
I made some slight changes to allow for START and END not being at the beginning of the line. Also, I eliminated the use of the "comma operator" in the sub's while statement in favor of an "and" statement. This should handle the case of a malformed record missing an "END" at the end of the DATA a bit better. Your DATA as posted does indeed work as hippo demonstrates. This code should work on any Perl >= 5.6 - nothing "fancy" about it. This is a very exacting business and when making a bug report, please post exactly the DATA that causes the problem, verbatim. As a comment, this malformed "START" record problem applies to all of the code in this thread. This is not unique to my code. " START" vs "START" is my best guess as what you did wrong in your DATA. In reply to Re^3: Getting lines in a file between two patterns
by Marshall
|
|