sub r_reset { # This routine emulates the Perl CORE reset function # which is deprecated. It does not work without an # argument as ?? ops are also deprecated. die "Wrong args to r_reset" unless 1 == @_; my $chr = shift; die "Invalid characters in arg to r_reset" unless $chr =~ /^[-\w]+$/; die "Uppercase characters in arg to r_reset" if $chr =~ /[A-Z]/; my $pkg = caller(); no strict 'refs'; foreach my $var (grep /^[$chr]/, keys %{"$pkg" ."::"}){ undef ${$pkg . '::' . $var}; undef @{$pkg . '::' . $var}; undef %{$pkg . '::' . $var}; } }