The relationship between my input in $file and my desired output does exist if you look closely - the data points are in the table, and I have to create a table as a requirement of the script. This example was probably not the best choice because it is too much like what I'm really trying to do and not very clear. I could not connect the two because I wasn't sure how organize the data in #1 to get to #2. now that you have showed me that I might be able to put together another example in another posting that makes this more clear.