'local' temporarily changes the value of the variable, but only within the scope it exists in.
'my' creates a variable that does not appear in the symbol table, and does not exist outside of the scope that it appears in.
$::a refers to $a in the 'global' namespace.
use local when:
- you want to amend a special Perl variable, eg $/ when reading in a file. my $/; throws a compile-time error
No comments:
Post a Comment