Thanks, one issue is still there. If the field is empty (no white spaces) then this is valid because the value was not provided and will go to valid file.
But if the field contains only blank spaces, then this is invalid. I just want to remove all white spaces from the field and make it null before doing the comparison.
I have tried this:
chomp($pending_move_out_dt);
$pending_move_out_dt =~ s/\s//g;
But the record is still going to invalid as the field $pending_move_out_dt is empty but containing white spaces. It should contain nothing where there is no data (just null value).