print MyModule::SharedArray[1]; # prints 2
Should be $MyModule::SharedArray[1] The variable name still needs a sigil for full qualification.
In Perl, each module has its own namespace.
Each module can be given its own namespace (as shown in the code example via package) or, indeed, any namespace. It's not automatic.
In reply to Re^2: Fill an array in a module ?
by AnomalousMonk
in thread Fill an array in a module ?
by DarrenSol
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |