in reply to Re: BEGIN initialization and memory
in thread BEGIN initialization and memory
What would you expect to happen here?
BEGIN { my $x = 'foo'; }
Outside of the block, would you expect to see a variable named $x? Would you expect it to have a value?
In fact, it doesn't, because the normal lexical scoping rules apply. BEGIN isn't extra special magic in that variables leak out. It's just a normal block that happens to execute at a special time.
|
|---|