This is
exactly why we have things like the
strict pragma. PLEASE, if you have any unusual behavior in your scripts, be
certain that you are
useing
strict and that your code generates no warnings with
-w. This would have caught your problem (or at least forced you to think about the scoping of this variable, which I would hope would have brought attention to the issue)!