use ???; my $tmp = ???save('My::'); ... $My::a = ... push @My::b, ... $My::c{key} = ... ... if (! success) { ???restore($tmp); }