Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Here’s another possible use for dynamic scope: you have a subroutine whose behavior depends on the setting of a global variable. This is usually a result of bad design, and should be avoided unless the variable is large and widely used. Suppose that this is the case, and that the variable is called %CONFIG.
You want to call the subroutine, but you want to change its behavior. Perhaps you want to trick it about what the configuration really is, or you want to see what it would do if the configuration were different, or you want to try out a fake configuration to see if it works. But you don’t want to change the real global configuration, because you don’t know what bizarre effects that will have on the rest of the program. Do this: