in reply to How do create a variable in another package in Perl?
There's no real need to "create" variables in another packages, because they are entries in the symbol table that can autovivify. Nonetheless you can do something like @YourPackge::VariableName = (1, 2, 3);
Though it is rare that this is a useful and a good idea. Maybe try to explain what you want to achieve in the end, then we can think about better approaches. It could be an XY Problem.
(For example it might be better to export variables from a module that you use in the namespace in question.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do create a variable in another package in Perl?
by PerlOnTheWay (Monk) on Dec 12, 2011 at 09:03 UTC | |
by GrandFather (Saint) on Dec 12, 2011 at 09:20 UTC | |
by moritz (Cardinal) on Dec 12, 2011 at 09:18 UTC | |
by Anonymous Monk on Dec 12, 2011 at 09:48 UTC |