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

Jamin has asked for the wisdom of the Perl Monks concerning the following question:

I need some Perl help from the masters. I haven't been able to figure this one out, or find anyone who can even begin to figure it out.

I have 2 data files I am trying to combine, and I have not been able to figure out a good way to do this that is not really sloppy. As an example, consider a Bug Tracking database.

One file contains the Bugs:

BUGS.csv BugID,Date,Subject,Priority 9551,03/01/2008,This is the subject,1 9552,03/03/2008,This is the subject,2 9553,03/06/2008,This is the subject,1 9554,03/07/2008,This is the subject,0 9555,03/08/2008,This is the subject,5
BUG_Comments.csv CommentId, BugId, Date, CommentBody 1023,9555,03/06/2008,This is the body 1024,9555,03/07/2008,This is the body 1025,9555,03/08/2008,This is the body

I need to have all the Comments for one bug, concatenated into one field.

WANTED: BUG_Comments_COMBINED.csv BugId, CommentBody 9555,"03/06/2008 This is the body 03/07/2008 This is the body 03/08/20 +08 This is the body"

The history is this: I am writing a script to manipulate data to migrate from our old bug tracker to our new one. The new one has only one field for ALL the comments. It also will only allow a one-time import, no updates. So I have to have ALL the comments from ONE bug, in a giant comments field.

I have started this off 100 times and it get's so stinkin' convoluted, I can't even read it anymore.

ANY ideas? At All? This MUST have come up somewhere before?

Thanks!

-Jamin