nosbod has asked for the wisdom of the Perl Monks concerning the following question:
ok, I have a series of flat files whereby one line holds info relating to one individual. A method is called (via $obj->get_next) and the next line (individual) is read and dealt with.
I have a series of modules each to dealt with slightly different formats of this input file. My problem is that the format of one of the input files is such that instead of an individuals data existing in rows it exists as columns.
So, the best way of reading an individual at a time?
Each time $obj->get_next is called do I read in the whole file pulling out the correct column position in each row? Or, do I read the whole file in once (the first time $obj->get_next is called) and store in memory?
(I know that I could read the whole file in first time it is seen and write back out in a prefered format and then read from this file, but I am trying to avoid writing out to file) Is there a nicer way of doing this?
thanks in advance
Rich
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: reading columns from a flat file
by BrowserUk (Patriarch) on Mar 19, 2004 at 10:50 UTC | |
by nosbod (Scribe) on Mar 19, 2004 at 11:23 UTC | |
by BrowserUk (Patriarch) on Mar 19, 2004 at 11:54 UTC | |
by nosbod (Scribe) on Mar 19, 2004 at 12:11 UTC | |
by davido (Cardinal) on Mar 20, 2004 at 05:23 UTC | |
|
Re: reading columns from a flat file
by pelagic (Priest) on Mar 19, 2004 at 10:28 UTC | |
by nosbod (Scribe) on Mar 19, 2004 at 11:08 UTC | |
|
Re: reading columns from a flat file
by Somni (Friar) on Mar 20, 2004 at 10:24 UTC |