8

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
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
sid_com
  • 24,137
  • 26
  • 96
  • 187

1 Answers1

10

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.

ysth
  • 96,171
  • 6
  • 121
  • 214