First, I suggest that you spend a few bucks on 'Programming the Perl DBI' by Descarte and Bunce from O'Reilly. While it is primarily about RDBMS's, it has a chapter on playing with text files( mapping, using DBMs, using DBI with csv files, and using plain old text). It is well worth the $35 (US),( I think 35, about that, anyway).
It is possible to open a file for both read and write and to jump (seek) to a specific spot in that file, do some stuff and hop out. However, most applications that I have seen using flat files don't do it that way. Figuring out to where you want to seek can be more work than it is worth. Instead, I suggest a more blue collar approach.
open the output file.
flock - lock the output file.
quickly figure out what you want to do and do it.
flock - unlock the output file.
close the file.
Engineer the flocking into any application that uses the file(s). Each app will check to see if the file is flocked, and if necessary, wait its turn. As you might imagine, you will want to keep the flock periods as short as possible to keep the line of waiting processes short.
If flat files are sufficient for your purposes, then this approach suffers from very little overhead and is very simple. I have one web based help request tracking system that is up to about 800 requests. It produces a report of the key words sorted and printed back to a browser in about 2 seconds running on a fairly modest and slightly dated Sun machine. That system uses some XML-ish tags for tagging the data elements. Your situation should be faster since you can use split instead of pattern matching to get at your data elements. Don't for get to take the new lines and carriage returns out of the input before you print to that format.
If you anticipate the eventual need to go to a database server, then you might want to start with the DBI::Stuff for text files. That way, when you make the transition, all you change is the connect string(maybe a few other tweaks) and you are off to the races.
Feel free to ask for more specifics if you need. There are a few previous threads dealing with using flock that you can search for.
HTH
keep the rudder amid ship and beware the odd typo