my $x = 2; sub A { local $x = 3; &B; } sub B{ $x } print &A; #prints 3 not 2