In addition to the other answers, there is a bug around the construct my $foo if condition(); that causes previous values to be kept when condition() is false. I would highly recommend that any large codebase be grepped for variations on this construct - usually it causes a subtle bug that would be hard to track down.