Assuming both a local($var) and a my($var) exist, what's the difference between ${var} and ${"var"}?

Q

Assuming both a local($var) and a my($var) exist, what's the difference between ${var} and ${"var"}?

✍: Guest

A

${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.

2013-08-26, 1572👍, 0💬