There is a theme developing in your questions and the answer to all of them is: database! Maybe the most useful thing you can do at this point is take a step back and tell us what you are trying to achieve with these 100's of files because that will influence what your database looks like and how it can be efficiently created from your files. You should also tell us if the file generation process is ongoing and whether you want to generate the output file once or, if more then once, what changes each time you generate the output.
Perl is the programming world's equivalent of English