|
|
| laziness, impatience, and hubris | |
| PerlMonks |
Re^2: Can you create *real* global variables?by Anno (Deacon) |
| on Mar 11, 2007 at 16:45 UTC ( [id://604239]=note: print w/replies, xml ) | Need Help?? |
|
Please put <code>...</code> tags around code.
What's to solve? Are you asking why the package variables $main::V1 and $main::V2 aren't defined when foo::fetchvar() is called? That's because they were never set. Instead, you set the lexical variables (of file scope) $V1 and $V2. Change the my declarations for $V1 and $V2 to our and your code will do what (I suppose) you expect it to do. Anno
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||