http://www.perlmonks.org?node_id=678169


in reply to Re: Global destruction feature / bug ?
in thread Global destruction feature / bug ?

Just to play devil's advocate . . .

The name declared by the our isn't globally visible, but the value residing in the symbol table which it refers to is a global. The only difference is the duration of the scoping of the name you're using to access it, so it's entirely reasonable that that value is destroyed along with the normal global variable cleanup pass regardless of how you're accessing it.

(To put it another way, you would definitely be surprised if the value in the global $main::foo was destroyed just because the temporary reference to it you created with local *somepackage::foo = \$main::foo; goes out of scope.)

The cake is a lie.
The cake is a lie.
The cake is a lie.