Typeglob and symbol table

xiaoxiao2021-03-06  114

The content of the package is generally called the symbol table together. The symbolic table is stored in a hash, the name of this hash is the same as the name of the package, but it is only necessary to add two colons. The MAIN package symbol table is% main ::.

Perl uses the symbolic table to map the identifier (such as $ A, the 'A' string of the prefix is ​​the identifier) ​​to the corresponding value. However, the hash table does not allow repeated key values, so we can't give two entries that have the same name in the hash table to two different values. So the Perl placed a data structure called Typeglob between the symbolic table and other data types.

In the hash of the symbol table, each key / value matches the identifier and its value. The key is the symbol identifier, and the value is the corresponding TPyeglob.

* Sym = $ main :: {"variable"} This is almost the same as * SYM = * main :: variable

Typeglob is a real data type that can be used in the scripter, which has prefix "*".

Typeglob is a set of pointers of a set value, each of which is a value type; and the TPyeglob itself can be seen as a hash, which has different types of variable records.

* SYM = * main :: variable * Sym {scalar} and / $ SYMs * SYM {Array} and / @ SYMs * SYM {HASH} * SYM {Glob} * SYM {Name} Symbol identifier which name comes * SYM {package} which package of symbol identifier

转载请注明原文地址:https://www.9cbs.com/read-103217.html

New Post(0)