This behaviour is somewhat of a bug, in that it's unexpected behaviour, but it's not going away anytime soon. It is caused by perl not clearing it's lexical pads on exit, for efficiency reasons. See. the classic Unusual Closure Behaviour for an exhausitive discussion on the subject.