## Example 1 our $x = "Hello"; sub f { local $x = "Goodbye"; ...; } f(); ## Example 2 our $x = "Hello"; sub f { my $original = $x; $x = "Goodbye"; ...; $x = $original; # restore } f();