You cant delete the typeglob while a reference to it still exists (from $a or $b). You can however make it undefined, (freeing up any IO handles etc attached to it) with the following: