in reply to Use of uninitialized value warning on print
I thought at first it might be the \n at the end of the print statement at the end, I removed it and still get the warning. Can anyone point me in the right direction? Ill post the config file ...No need to post the config file just yet. Do you understand the error? Can you write a one-liner that will reproduce the error? Here's an example
Is that close to what you wrote? Now try thisperl -we"print $_" Use of uninitialized value in print at -e line 1.
perl -Mdiagnostics -we"print $_"
Use of uninitialized value in print at -e line 1 (#1)
(W uninitialized) An undefined value was used as if it were already
defined. It was interpreted as a "" or a 0, but maybe it was a mistake.
To suppress this warning assign a defined value to your variables.
To help you figure out what was undefined, perl tells you what operation
you used the undefined value in. Note, however, that perl optimizes your
program and the operation displayed in the warning may not necessarily
appear literally in your program. For example, "that $foo" is
usually optimized into "that " . $foo, and the warning will refer to
the concatenation (.) operator, even though there is no . in your
program.
So what is line 95 of your program?
It's So what does the error message mean then? It means that either $name, $sts, $svcwatch, $description or $nowstring is undefined.print NEWSTATS "$name,$sts,$svcwatch,$description,$nowstring\n";
Do you now know how to fix it?
Considered by holli: "make this a categorized answer." Vote (keep/edit/delete)=6/9/1
Unconsidered by davido: Consideration doesn't make sense. Without the thread, moving this reply would take it out of context.
|
|---|