If I'm not wrong we can't change a glob key/element, only access it. Soo, this won't work:
undef *{$glob}{$type} ;
And I make this:
if ($type eq 'SCALAR') { undef ${*{$glob}} ;}
elsif ($type eq 'ARRAY') { undef @{*{$glob}} ;}
elsif ($type eq 'HASH') { undef %{*{$glob}} ;}
elsif ($type eq 'CODE') { undef &{*{$glob}} ;}
elsif ($type eq 'IO') { close *{$glob} ;}
Not to remove the element from the GLOB, but to ensure that it goes out of the memory, since undef *{$glob} already remove all the keys/elements. Actually for your needs you can remove all the if ( $type eq '...' ).
Graciliano M. P.
"Creativity is the expression of the liberty".