write_file
will overwrite the file unless the append => 1
option is given. So this:
write_file( $outFile, { binmode => ':utf8' }, $source_cell->Value, ";" );
Will write a new file for each new cell value. It does however not match your description of "only one row of semi-colons of empty fields", as it should only be one semi-colon, and one value.
I am doubtful towards this sentiment from you: "For convenience I like to use the module File::Slurp"
. While the print
statement works as it should, using File::Slurp
does not. So how is that convenient?
What you should do, if you still want to use write_file
is to gather all the lines to print, and then print them all at once at the end of the loop. E.g.:
$line .= $source_cell->Value . ";"; # use concatenation to build the line
...
push @out, "$line\n"; # store in array
...
write_file(...., \@out); # print the array
Another simple option would be to use join
, or to use the Text::CSV
module.