# Save a reference to the original variable: *nothingToSeeHere::var= \$var; # Replace the variable with a new variable instance and assign # that new instance the given value (or undef if none mentioned): *var= \undef; # (but see footnote) # Restore the previous instance (and thus the previous value): ON_SCOPE_EXIT { *var= \$nothingToSeeHere::var; }