in reply to reset function

Pretty sure you don't know what you are doing (see XY Problem)

But FWIW:

use strict; use warnings; my $var = 42; # lexical var our $van = 42; # package var { my $var = 10; local $van = 5; print "Var value =$var, Van value =$van\n"; } # Leaving block "resets" scoped variables print "Var value =$var, Van value =$van\n";

thats the Perl way to realize "resets".

But we normally just use different namespaces/scopes or just entries of a hash %v.

Cheers Rolf

( addicted to the Perl Programming Language)