TITLE - merger - Program to merge project and requirements files.


perl merger.pl


This program creates an ouput file which consists of one line for each project. A line consists of the project name and a description of all of its functions. The project name and list of integer function codes are extracted from one file (File_A). The codes are replaced with the corresponding descriptions specified by the other file (File_B).


This program has no commandline or runtime options.


No environment varaiables are use by this program.


All files are ASCII text files with UNIX newlines. They are all stored in the current working directory.

Input Files

A sample of each file is available as an attachment to the original requirements. Refer "SEE ALSO" for details.


All records of this file consist of two tab-separated fields. The first is a project name. The second is an integer function code. All records pertaining to the same project are contiguous. There is no limit to the number of functions which may be specified for a project.


All records of this file consist of an integer function code and a variable number of fields which describe the function. All fields are tab-separated.

Output File


There is one record in this output file for each project specified by input File_A.txt. Each Record consists of a project name, a tab character, and a list of function descriptions from File_B.txt. Descriptions are separated by a tab-comma sequence. Function descriptions retain the tab field separators from File_A.


All program diagnostics may be followed by a more detailed OS dependent explanation of the error. Failure to open a file almost always means that the file does not exist in the working directory or the file (or its directory) do not have the required permissions.



There are no known bugs in this version.


This version works only on the specified files. There is no provision to specify alternate input or output files.


This program was written in response to requirements posted by Thalakos in the perl guru forum ("SEE ALSO").


The original requirements can be viewed in the thread: Merges 2 text files under few very difficult conditions from Thalakos

This thread includes sample input files as an attachment.


The initial version was posted in a reply to the requirements. Minor corrections were posted in a later response in the same thread.

This version (identified as v2.0.0) simplified the algorithm by eliminating the need for the table_of_contents hash (%toc) and added this docmentation.


William K. Smith


Copyright (2012) by William K. Smith

This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.