in reply to Re: HoH Weirdness
in thread HoH Weirdness
I'm going to guess that the moment the interpreter sees that the string 'Apple' can be made into a reference, it marks 'Apple' as a valid reference for everyone. Why it affects the hash seemingly defined before it? Because, the interpreter, in its first pass, will find all the possible references and remember those. Then, in the second pass, it will use those references it knows about.No, that's too much voodoo. It's simpler than that. The first hash assignment puts values in %main::Apple, using a symref (use strict would have caught that.) And the second set of assignments causes it to reference %main::Apple as well, the very same hash.
No magic needed to explain that.
-- Randal L. Schwartz, Perl hacker
|
|---|