in reply to Variable being clobbered by a seemingly unrelated while loop
# I know there should be
What do strict/warnings say?
See Re: foreach loop and creating files with "$_" and local $_; in your subroutine before the loop