Assuming both a local($var) and a my($var) exist, what's the difference between ${var} and ${"var"}?
Perl Questions and Answers
(Continued from previous question...)
Assuming both a local($var) and a my($var) exist,
what's the difference between ${var} and ${"var"}?
${var} is the lexical variable $var, and
${"var"} is the dynamic variable $var.
Note that
because the second is a symbol table lookup, it is
disallowed under `use strict "refs"'. The words
global, local, package, symbol table, and dynamic
all refer to the kind of variables that local()
affects, whereas the other sort, those governed by
my(), are variously knows as private, lexical, or scoped
variable.
(Continued on next question...)
Other Interview Questions
|