Thanks for your suggestions and the part that isn't working is the "foreach $line2". I think what is going wrong is that the code is overwriting the first position in the array, so I guess the question is how to I increment the scalar so it writes to a new position in the array? Also thanks for the general perl comments, I am really new to this and am trying to learn as much as I can as fast as I can; all the comments are a big help!