Note that your approach to widely scoped lexical variables (those are not globals, by the way) could be a real problem in a persistent environment like FastCGI, PerlEx, or mod_perl. Those are closures, so if any of them didn't get set on a particular request they would retain their previous values.