in reply to Re: eval not behaving like I expected... why?
in thread eval not behaving like I expected... why?
Good thought... taking the "my" out now gives the following spew:
Following that thought one step further, let's declare them as "our." Run the code and we still see spew, but not as severe:$ perl loadData.pl Name "main::fum" used only once: possible typo at loadData.pl line 16. Name "main::fo" used only once: possible typo at loadData.pl line 16. Name "main::fi" used only once: possible typo at loadData.pl line 16. Name "main::fee" used only once: possible typo at loadData.pl line 16. Variable "$fee" is not imported at (eval 1) line 1, <DAT> line 1. Global symbol "$fee" requires explicit package name at (eval 1) line 1 +, <DAT> line 1. Variable "$fi" is not imported at (eval 2) line 1, <DAT> line 2. Global symbol "$fi" requires explicit package name at (eval 2) line 1, + <DAT> line 2. Variable "$fo" is not imported at (eval 3) line 1, <DAT> line 3. Global symbol "$fo" requires explicit package name at (eval 3) line 1, + <DAT> line 3. Variable "@fum" is not imported at (eval 4) line 1, <DAT> line 4. Global symbol "@fum" requires explicit package name at (eval 4) line 1 +, <DAT> line 4. $VAR1 = undef; $VAR2 = undef; $VAR3 = undef;
$ perl loadData.pl Name "main::fum" used only once: possible typo at loadData.pl line 16. Name "main::fo" used only once: possible typo at loadData.pl line 16. Name "main::fi" used only once: possible typo at loadData.pl line 16. Name "main::fee" used only once: possible typo at loadData.pl line 16. $VAR1 = 'FEE'; $VAR2 = 'FI'; $VAR3 = 'FO'; $VAR4 = 'fee'; $VAR5 = 'fi'; $VAR6 = 'fo'; $VAR7 = 'fum';
I guess in the end that means that you have to pre-declare the variables before reading in the "configuration file" and getting the values defined. Not pretty... but it works. I like the way I normally do it better. Which is to sey I either create a module and export my values or I use something like XML::Simple to do the dirty work.
|
|---|