local *HANDLE; local $SIG{ALRM} = 'ignore'; my $x = 2; ################# UPDATE ####################### ## Without removing my mistake above, so that ## anybody reading this node will note how ## silly (see Dominus's generous -cough- reply) ## I was (and I was silly to post code that I ## would never actually use and hadn't tested ## in a negative response to an almost saintly monk). ## ## The reason the code failed is because ## I need to do something like: ## use vars qw($x); ## OR ## $main::x; ## Otherwise, local will fail (as per ctl's reponse) ## because it doesn't have access to "my"ed variables. ## It won't fail on the grounds that you shouldn't use ## local. ## ## Dominus didn't answer the response. ## There are still times when you need to use local ## (and saying only use IO::Handle or Symbol::gensym() or ## don't use SIG's is not an appropriate answer -- ## sometimes we have no choice but to use FILEHANDLES ## and SIG's) ## ## Meanwhile maybe I should post a meditation about ## answering with answers and not predispositions. ################# UPDATE ####################### sub A { local $x = 3; &B; } sub B{ $x } print &A; #prints 3 not 2