if the whole thing is read in a table, you would only have to make 2 foreach and check each line against each other. this could take a while, but its a onetime srcipt, so who cares?

. for the length... isnt there a linelength count command!? just include this check ^-^.