in reply to Relational textfile?

Are you familiar with SQL? If so then I would suggest trying to use DBI together with either DBD::CSV or DBD::RAM as database drivers.

A side benefit is that when you are done it will be relatively little work to move your script to running against a real relational database.