in reply to variables get overwritten (loop problem? i dunno)
Use strict and use warnings. I also didn't enjoy searching for those variables in that sea of print statements. I could just see Randal cringing. Try using CGI.pm html short cuts. Then come back and ask again. . . . ;-)