The answer to use warnings can be used lexically correctly. The decision to use no warnings lexical and use warnings globally is more correct. The best decision is to fix all your warnings. Somewhere between them there is a redirection of errors.
use warnings; open STDERR, ">>", "foo/error.log" or die $!;
Leave this for a while, then run:
perl -nlwe '$a{$_}++ }{ print for keys %a' foo/error.log > foo/errors.dedupe
Go through the code and correct the warnings. Most likely, if the script works, they will be trivial. But if you don’t check, how do you know?
If at the end you decide that it is not a hassle to fix all warnings, simply remove the warnings and redirect errors and use the warnings lexically.
source share