in reply to Re^2: Eval/package question
in thread Eval/package question
(the package variable (%items above) is not available).
It is not, because %items is declared as a my variable and thus available only in the the package itself, not in the main package.
If you have to access it from main, you either have to fully qualify it as %items::items, or provide methods to access it (exporting it, providing accessors or a method which returns a reference to it, etc), but it's hard to say what's best without knowing the whole scenario.
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Eval/package question
by Anonymous Monk on Jan 21, 2020 at 16:26 UTC |
In Section
Seekers of Perl Wisdom