I wanted to confirm if a variable delcared in a file is accessible and can be modified throughout the file, even inside a function, and that seems to be true.
my creates a variable that's visible in the current lexical scope (i.e. block or file).
Nothing like "masking earlier declaration of $val". It just treats it as if it were a different variable.
It is a different variable. And I'm also disappointed that this doesn't warn. The warning is only issued when you create two lexical variables in exactly the same scope.
In reply to Re: Perl Variables storage location and scope question.
by ikegami
in thread Perl Variables storage location and scope question.
by pritesh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |