in reply to Accessing hash from within module
You might think of importing the variable into your main package, if it is defined in a module.
That's actually do the same thing as Jenda's code snippets, but it looks just a bit less hacky. See Exporter for one way to implement it.
You could also think of declaring the global variables in a dedicated module and use it in any module that requires access to them.
Also note that you can use "::" as short for "main::". So you could just spell it as %::lglobal (and $::lglobal{$key}), which doesn't look to bad to me. You could event think of the "::" prefix as hungarian notation, so it could even work out for the better.
|
---|
In Section
Seekers of Perl Wisdom