That if ought not to produce warnings. If $rec->[IMP_WG] or $rec->[CSC_HAN] is undefined, the warning should show the print STDERR line.
Is it possible that you have an elsif clause? Use of an undef value in it will produce a warning giving the line number of the if, since that is the beginning of the statement.