I don't believe that you can redefine a subroutine during execution. You might be able to simulate it by calling a subprocess, however allowing for user define subroutines is risky at best.
Based on your code I think you might be better served storing arrays in the hash. that way you can update the hash and have new values immediately available and write the updated hash to the file (or just tie the hash so updates are automatic)
something like:
%myhash = (
set0 => [ "a", "b" ],
set1 => [ "c", "d" ],
);
then to access the values have a sub something like:
sub updatevars {
my $set = shift;
$var1 = $myhash{$set}[0];
$var2 = $myhash{$set}[1];
}
and call the sub with:
my ($var1,$var2);
updatevars("set0");