#!/usr/bin/perl use Data::Dumper; my $var = "Yak"; ${ 'Yakkity::' . $var . '::a' } = 42; print "a = $Yakkity::Yak::a\n"; print Dumper \%Yakkity::Yak::; print "Undeffing symbol table\n"; undef %Yakkity::Yak::; print "a = $Yakkity::Yak::a\n"; print Dumper \%Yakkity::Yak::; print "Undeffing glob\n"; undef *Yakkity::Yak::a; print "a = $Yakkity::Yak::a\n"; print Dumper \%Yakkity::Yak::;
And the output:
a = 42 $VAR1 = { 'a' => *Yakkity::Yak::a }; Undeffing symbol table a = 42 $VAR1 = {}; Undeffing glob a = $VAR1 = {};
So, what's going on here? How does perl know how to find $Yakkity::Yak::a after the package's symbol table is gone? Shouldn't *Yakkity::Yak::a have been deleted with it? Or does another reference to it exist outside the symbol table? If so, where? Suppose I were creating dynamic packages at runtime and I want to make sure all the stuff in them gets destroyed. How would I ensure that?
In reply to Undefining symbol tables and globs and things, oh my by friedo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |