I tend to think of using "our $var;" as the equivalent of an external command in C/C++, a way to link a file global var across mulitple files.
This is correct; but in all files this variable should be declared with our. But there's more to variables declared with 'our':
Example:
package Foo; our $foo = 'foo'; # $Foo::foo now exists package main; print $foo,"\n"; # $Foo::foo, not $main::foo ! print $Foo::foo,"\n"; __END__ foo foo
In reply to Re^3: Tricky scope problem
by shmem
in thread Tricky scope problem
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |