in reply to my Hash Persisting?

You should add the line use strict; to the top of your script. After fixing the minor errors ($k and $v should be declared), Perl will then point out to you that what you maybe think you're doing is not what you are actually doing:

Can't use string ("group1") as a HASH ref while "strict refs" in use a +t...

The code around line 18 looks like this:

... $test_hash{$group} = $group; for (my $i = 0; $i < scalar @vals; $i++){ $test_hash{$group}{$vals[$i]} = $vals[$i]; } ...

The first assignment stores a string, 'group1', in $test_hash{$group}. Then, in the loop, you're dereferencing that string, which Perl interprets as you wanting to access the global variable of that name, %group1. This global variable persists across function calls, naturally.

Using soft references like that is dangerous because you can easily effect an action at a distance without even knowing what you're doing. The strict pragma prevents you from unknowingly using soft references.