Perl parse CSV file "fill" and "null" fields

Okay - I'm going to post my entire script since I get chastised when I don't do it - even though, last time I did that I got chastised for posting the whole script. I simply need to know if the one line I originally asked about would work. ENTIRE SCRIPT (which was working just fine until the other dept gave me their data entirely differently than what we were originally told it would be) TO FOLLOW AT THE END

I'm parsing through and scrubbing a CSV file to make it ready to be loaded in a MySQL table. It is loaded through the table via someone else's "batch Java program" and if any field is empty the batch file stops with an error.

I've been told to just put in a blank space whenever there's an empty field in any record. Would something as simple as this work?

if ( ! length $fields[2] ) {
$_ = ' ' for $fields[2];
}

And would there be a way to check either various multiple fields at once? Or what might be better would be to check ALL the fields (this is after the record has been split) as the last thing I do just before writing the record back out to the CSV file.

Here's the entire script. Please don't tell me how what I'm doing within the already working script is not how you would do it. -

#!/usr/bin/perl/

use strict;
use warnings;
use Data::Dumper;
use Time::Piece;

my $filename = 'mistints_1505_comma.csv';
#my $filename = 'test.csv';

# Open input file
open my $FH, $filename
or die "Could not read from $filename <$!>, program halting.";

output

Having seen your full program, I recommend something like this. If you had shown a sample of your input data then I could have used a hash to refer to column names instead of numbers, making it much more readable