File: gawk.info, Node: Changing The Namespace, Next: Naming Rules, Prev: Default Namespace, Up: Namespaces 15.4 Changing The Namespace =========================== In order to set the current namespace, use an '@namespace' directive at the top level of your program: @namespace "passwd" BEGIN { ... } ... After this directive, all simple non-completely-uppercase identifiers are placed into the 'passwd' namespace. You can change the namespace multiple times within a single source file, although this is likely to become confusing if you do it too much. NOTE: Association of unqualified identifiers to a namespace is handled while 'gawk' parses your program, _before_ it starts to run. There is no concept of a "current" namespace once your program starts executing. Be sure you understand this. Each source file for '-i' and '-f' starts out with an implicit '@namespace "awk"'. Similarly, each chunk of command-line code supplied with '-e' has such an implicit initial statement (*note Options::). Files included with '@include' (*note Include Files::) "push" and "pop" the current namespace. That is, each '@include' saves the current namespace and starts over with an implicit '@namespace "awk"' which remains in effect until an explicit '@namespace' directive is seen. When 'gawk' finishes processing the included file, the saved namespace is restored and processing continues where it left off in the original file. The use of '@namespace' has no influence upon the order of execution of 'BEGIN', 'BEGINFILE', 'END', and 'ENDFILE' rules.