N
Nick Wedd
I have always found that putting "use strict" makes life easier for me.
But now, I am trying to use what C programmers call "#include". I have
a "main.pl" file, which needs to include another file where values are
assigned to a variable. I have tried all combinations of
use "includedfile.pl" or require "includedfile.pl"
declaring the variable (a hash) in the main file, or the included file
declaring the variable before or after the use/require statement
declaring the variable as "my" or as "local"
but whatever I try, Perl complains about uninitialised or undeclared
variables.
I have found that if I don't declare my hash at all, and use
'require "includedfile.pl"', it behaves as I want, the values assigned
in the included file are usable in the main file. Of course, failing to
declare a variable means I can't use 'use strict'.
So, I would like to know what the recommended way is of declaring the
kind of variable that you get when you just use one without declaring
it. This way, I would be able to have my #include working and still
have "use strict" there to help me.
Nick
But now, I am trying to use what C programmers call "#include". I have
a "main.pl" file, which needs to include another file where values are
assigned to a variable. I have tried all combinations of
use "includedfile.pl" or require "includedfile.pl"
declaring the variable (a hash) in the main file, or the included file
declaring the variable before or after the use/require statement
declaring the variable as "my" or as "local"
but whatever I try, Perl complains about uninitialised or undeclared
variables.
I have found that if I don't declare my hash at all, and use
'require "includedfile.pl"', it behaves as I want, the values assigned
in the included file are usable in the main file. Of course, failing to
declare a variable means I can't use 'use strict'.
So, I would like to know what the recommended way is of declaring the
kind of variable that you get when you just use one without declaring
it. This way, I would be able to have my #include working and still
have "use strict" there to help me.
Nick