in reply to Re^2: type glob
in thread type glob
Ok, I did some reading about symbol tables, and if I understand them correctly, they are just hashes that contain the variables in your program. The keys in the hash are the variable's names and the values are the variable's values. However, the docs say that the symbol table hash does not contain "my" variables--only dynamic variables. What is a dynamic variable? Anything that isn't a my variable?
The place that I'd look for documentation on the symbol table is Symbol Tables, but I don't see any use of the term ‘dynamic variables’ there (and I wouldn't expect to see one in the Perl documentation; it's not a standard term). Did you look somewhere else?
Variables in Perl are either local *, in which case they are lexically scoped, or global, in which case they are dynamically scoped. It is global (or, better, ‘package’) variables that you will find in the stash. Lexicals are created with my, as you say; globals are created with our, or, if you are naughty and don't use strict, implicitly whenever you reference a previously un-declared variable.
UPDATE: Sorry, I was very very slow (had to go to class in the middle) and ikegami gave a (slightly more admonitory :-) ) reply first.
* Except that we call them lexicals, not locals, because they have nothing to do with the variables referenced (not created) by local.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: type glob
by 7stud (Deacon) on Nov 17, 2009 at 20:22 UTC | |
by ikegami (Patriarch) on Nov 17, 2009 at 22:19 UTC | |
by JadeNB (Chaplain) on Nov 18, 2009 at 15:53 UTC | |
by ikegami (Patriarch) on Nov 18, 2009 at 19:03 UTC | |
by JadeNB (Chaplain) on Nov 18, 2009 at 20:29 UTC | |
| |
by JadeNB (Chaplain) on Nov 17, 2009 at 20:33 UTC | |
by Anonymous Monk on Nov 18, 2009 at 03:13 UTC | |
by JadeNB (Chaplain) on Nov 18, 2009 at 15:57 UTC | |
by 7stud (Deacon) on Nov 18, 2009 at 10:11 UTC | |
by przemo (Scribe) on Nov 17, 2009 at 20:52 UTC |