How big is file1? If the keys fit into memory, a possible solution could be to
read all the John1 => "15.T" type keys into a hash and then parse file2 line by line...
Does the order of entries in the output file play any role?
May there be multiple matches and how to treat them?
Do you count the indexes starting with 0 or 1?
What is the significance of the dot+character (.T) after the index (15)? E.g., do they select a different file2?
Is this a one-time task? If not, why not start using a database?
Why not use a database?
What have you done so far (show some Perl code or describe your approach)?