开发者

Symbol-table: deleting entries

开发者 https://www.devze.com 2023-02-03 04:36 出处:网络
Why do I get the values from \"$n\" and \"$m\" after deleting the respective symbol-table-entries? 开发者_开发技巧#!/usr/bin/env perl

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消