http://www.perlmonks.org?node_id=921072


in reply to write to/append a specific line in output file

Your idea of putting the different sets into different files and then concatenating them together isn't as bad as you seem to think.

If you're not storing it in ram, you've got to put it on disk somehow, and that seems like the most straight-forward simple solution.

Having said that, what are you doing that requires this strange file format? Often when someone asks a question like this it turns out that there is a better way once we know more about the overall situation. Of course, often it also turns out that you just need a quick fix and you don't want to hash out the whole project, which I totally understand.

--Pileofrogs

  • Comment on Re: write to/append a specific line in output file

Replies are listed 'Best First'.
Re^2: write to/append a specific line in output file
by aquinom (Sexton) on Aug 23, 2011 at 14:52 UTC
    I'm converting genome data to an input format for a software tool called PLINK that takes .ped files which mean an entire genome is on 1 line hence the strange format.
Re^2: write to/append a specific line in output file
by aquinom (Sexton) on Aug 23, 2011 at 18:48 UTC
    in fact I might still go about doing it that way. Seems like this is re-writing the entire file every time it adds a new piece of data, so this is extremely slow unless you use "deferred writing" in which case it would store everything in memory and I would have gained nothing by using this.