Perl Monk, Perl Meditation | |
PerlMonks |
Re: Splitting a file based on matched conditionsby Marshall (Canon) |
on Sep 19, 2017 at 18:27 UTC ( [id://1199691]=note: print w/replies, xml ) | Need Help?? |
Below is some "starter code" for you showing another method of doing this. Rather setting flags in the main body of the code, calling a subroutine to handle processing the record can be a good way. If you are in the subroutine, then that means that you are inside the record - no need to have a specific flag for that status.. 100K lines isn't big enough to worry much about seeking around. I'd just save the data in a buffer and then decide what to do with it when you see the End line. You can also look at: Flipin good, or a total flop? I use a variety of methods for similar tasks with some attention to who I'm writing the code for and the level of Perl expertise I expect them to have. Most of the time the number of lines of code is meaningless as long as it is clear and well structured.
In Section
Seekers of Perl Wisdom
|
|