Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Parse File With Sub While Loopsby fsn (Friar) |
on Sep 16, 2002 at 21:51 UTC ( [id://198381]=note: print w/replies, xml ) | Need Help?? |
You give too little information for me to make a more elaborate suggestion, but I'll try to give you a generic one. When processing a file like this, I try to make just one while loop, and then have some kind of statemachine-ish construction to do the actual work for me. The important thing is to avoid reading from the file in more than one place, like in the main loop and then a sub loop that exhausts some data, since that always seems to give me problems where I must reinsert data back into the buffer in some way, or handle special cases. So, this is my general design principle (in perl-ish pseudocode): No idea if this helps you.
In Section
Seekers of Perl Wisdom
|
|