|XP is just a number|
I do not maintain that this is the best way to do it, it's just my way....
I like to think of my subroutines in terms of giving instructions.
The reason I use this method is for readability. Read the file to get the lines, parse the lines to get the output, use the output to do the report. It allows me to quickly find the errant code block if there is a problem, and in the design phase I am left with a good outline to build my program around.
Now, on to questions of efficiency, mem footprint, etc... I don't really care. According to my boss, all of the servers work fast enough and I don't. Hence, my main goal is to speed up my work. Also, in a modern computer you should have better than 64MB of RAM, and the space taken up by some of the extra arrays is totally negligible.
Also, look at this write up by Merlyn on references. Passing references to subs will simplify your life at some point.
To redo your example my way:
Hope it helps... ~Hammy