in reply to Re^3: typeglob reference deletes global lexical
in thread typeglob reference deletes global lexical

mod_perl? Don't use "global" lexicals in mod_perl Registry script. Had you turned on warnings, you would have gotten one. mod_perl wraps your script in a function, so you basically get
sub mod_perl_wrapper { ##### Begining of script ##### use strict; use warnings; my $global = $_[0]; # Say some value from the request. sub foo { # Warms 'Variable "$global" will not stay shared' print("$global\n"); } foo(); ##### End of script ##### } mod_perl_wrapper(4); # First request prints "4" mod_perl_wrapper(5); # Subsequent requests also prints "4"

Use a package variable instead.

sub mod_perl_wrapper { ##### Begining of script ##### use strict; use warnings; local our $global = $_[0]; # Say some value from the request. sub foo { print("$global\n"); } foo(); ##### End of script ##### } mod_perl_wrapper(4); # 1st request prints "4" mod_perl_wrapper(5); # 2nd request prints "5"

I almost mentioned this earlier. I can't believe you went through all this trouble rather than turning on warnings. Even if you don't normally use them for whatever reason, adding use strict; and use warnings; is the first thing you should do when you have a problem you can't explain.