符号表:删除条目 [英] Symbol-table: deleting entries
本文介绍了符号表:删除条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么在删除了相应的符号表条目之后从"$ n"和"$ m"中获取值?
Why do I get the values from "$n" and "$m" after deleting the respective symbol-table-entries?
#!/usr/bin/env perl
use warnings;
use 5.012;
package Foo;
our $n = 10;
our $m = 20;
delete $Foo::{'n'};
delete $Foo::{'m'};
say $n; # 10
say $m; # 20
推荐答案
因为符号表仅在编译时使用(或通过符号引用使用). $Foo::{...}
值的glob由编译后的代码直接引用,因此不再存在的符号表条目无效.
Because the symbol table is only used at compile time (or via symbolic reference). The glob that is the value of $Foo::{...}
is referenced directly by the compiled code so the no-longer-present symbol table entry has no effect.
这篇关于符号表:删除条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文