Topic summary

Lexically scoped

Extracted from the Wikipedia article Scope (computer programming).

Lexical scope vs. dynamic scope

Most modern languages use lexical scope for variables and functions, though dynamic scope is used in some languages, notably some dialects of Lisp, some "scripting" languages, and some template languages. Perl 5 offers both lexical and dynamic scope. Functions that use lexically scoped variables are known as closures.