If I turn on the Perl debugging option then I get a warning like:
Use of uninitialized variable in line number so and so
after the initial lines are printed.
My question is that whenever I redirect the output of this script to some text file the debug warnings are written to the text file before the print statement in red is printed.
The flow of the script also does not conform to this weird behavior. Any idea folks?
Thanks.
Once there, listen to their error & warning messages and clean them up.
"Use of uninitialized variable in line number so and so" is telling you that you are trying to print a variable with no value. Use an 'if' condition to test this before you print it or initialize the variable with some value by default.
To remove this message from your output, redirect stderr when you submit your script.
./myprog 2> /dev/null
should do the trick, but it won't get rid of the warning.