vatheck has asked for the wisdom of the Perl Monks concerning the following question:
Every time I run this script with warnings on I get a warning that the variable $location is undeclared once for each line in the @workingdata array and I don't understand why. It appears to use "0" in the pattern match because it never matches any line which it would if it used "".{ while (my ($location, $devices) = each %devicecount) { foreach my $line (@workingdata) { my @Fld = split /,/, $line; if (/${location}TEXT/) { $somevar += $Fld[11]; $someothervar += $Fld[12] } } printf OUTPUT "some stuff from the info we gathered"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: uninitialized variable warning
by jwkrahn (Abbot) on Apr 30, 2008 at 02:47 UTC | |
by vatheck (Novice) on Apr 30, 2008 at 03:46 UTC | |
|
Re: uninitialized variable warning
by oko1 (Deacon) on Apr 30, 2008 at 03:13 UTC |