As you could probably tell, I'm new to Perl, so thanks for being gentle :)
Thanks for the comments, they were extremely helpful.
After the loop I am creating a new file; this program is for changing file formats.
One thing though: after ex# has been replaced with ex1, the subsequent ex# with matching @gtf[9] don't count up from ex1. They revert to the original ex# value+1 and count from there. I think that rather than taking the new ex1, its using the default ex# (like you said, changes made to @gtf are clobbered when the loop restarts). I guess I could specify ex1 as its own variable before the loop, like The Code Captain suggested...I'll test and see what happens.