They are not the same variable. The lexical variable declared as my $var is only accessible within the scope within which it is defined, whereas the package variable $main::var is essentially accessible anywhere. The package variable appears in the global symbol table whereas the lexical variables have their own 'pad' so they occupy a different namespace.
/J\
In reply to Re^3: What does $::var means
by gellyfish
in thread What does $::var means
by kprasanna_79
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |