in reply to Re: variable scope affects variables in crace shell escapes
in thread variable scope affects variables in crace shell escapes
As in some shells, you can enclose the variable name in braces to disambiguate it from following alphanumerics (and underscores). You must also do this when interpolating a variable into a string to separate the variable name from a following double‐colon or an apostrophe, since these would be otherwise treated as a package separator.
$a[$b] is the 6th element of the @a array ${a}[$b] is supposed to be the same as join '', $a, '[', $b, ']';
but if you declare the variable $a to be lexically scoped with my then perl seems to want to force them the construct to be considered as an array, which is wrong.
|
|---|