this stuff is way above my head.

here is a program (that works) which reads a text file with lines of the form

        James = "William"
        Leonard = "DeForest"
        Montgomery = "James"

and sets the variable $James to "William", and so on.  note that line 3 is
commented out.

1               #!/usr/bin/perl -w
2               use diagnostics;
3               #my $James;
4
5               open("FP", "< config");
6               while(<FP>) {
7                       chomp;
8                       /^(\w+)\s+=\s+\"(.*)\"/;
9                       $$1 = $2;
10              }
11              close(FP);
12              print ": $James\n";

the only error message is that this code produces is that "$James" might to a
typo because it appears only once in the code.  fair enough.  so i uncomment
line 3.   NOW the error message is that $James is uninitialized.

i don't completely grok scoping in perl, but this seems ridiculous.   why would
perl complain that the variable is uninitialized?

pete

-- 
"Coffee... I've conquered the Borg on coffee!"               [EMAIL PROTECTED]
       -- Kathryn Janeway on the virtues of coffee           www.dirac.org/p

Reply via email to