sub test_a { local $var = "Hello World\n"; } sub test_b { print($var); # Prints Hello World. } test_a(); print($var); # Doesn't print Hello World.