Why is this a global variable? The only usages I see of it is to unlet it before and after a loop, and then use it as the loop variable. We could perhaps have a local variable instead and then we don't need to unlet it twice?