"be consistent" | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hi monks,
I'm having this problem that I find very confusing, but which (I'm certain) has an easy answer which I can't find specifically addressed in the Q&A section or elsewhere.
Basically I have a perl library (.pl) file. In it I declare a global variable our $var to be used in other modules via require etc. I also use strict; and use warnings;. In my perl module (.pm) this warning appears when I start using the 'global' variable: Global symbol "$var" requires explicit package name... When I remove the use strict this error does not appear, but I suspect that the problem remains. Am I right in believing the $var variable is being re-declared in the perl module or has it become local to the perl module file, and the declaration our $var in the perl library file is ignored? All I want to do is use the straight $var in other files and for $var to act like a true global variable. simple code mock-up:
In reply to strict/warnings interference with global declarations by v_o_i_d
|
|