http://www.perlmonks.org?node_id=331262

AidanLee has asked for the wisdom of the Perl Monks concerning the following question:

Creating and assinging a subroutine reference to a typeglob is quite easy:
*{$name} = sub { return 'piece of cake' };
what I've not been able to figure out is how to remove one:

# error: Can't modify glob elem in scalar assignment 
*{$name}{CODE} = undef;

# error: delete argument is not a HASH or ARRAY element or slice
delete *{$name}{CODE};

# no error, but doesn't work:
delete $My::Package::{$name}{CODE};

what i'm basically looking for is a way to 'undo' changes made to the symbol table. Once i've registered a subroutine in a symbol table, i'd like to be able to unregister it later. There are many examples of the polymorphic assignment abilities of a typeglob in Programming Perl and Damian's OOP book, but nothing I can find there or online addresses removing things from the symbol table.