in reply to Re^4: globally seen variable
in thread globally seen vairable
A lesson you can learn from is that it's not efficient to ask very general questions first, if you really want to solve a specific problem; neither is asking a question that doesn't actually demonstrate the problem.
To answer your question, you need to either declare a lexical alias in each scope, to the same variable in the same package, or you need to qualify the namespace in one of the locations:
{ our $ERRORFILE = 'foo'; } { package RecordError; print $main::ERRORFILE, "\n"; }
|
|---|