in reply to Converting a delimited file.

This might be gross, but here is the brute force approach that I see:

while(<INFILE1>) { @file_line_contents = split (/\,/,$_); # this assumes that $file_line_contents[3] never contains the valu +e '0' $file_line_contents[3] ||= $file_line_contents[4]; # now get rid of the unneeded element (assumes this is the last el +ement in the array) pop @file_line_contents; print OUTFILE1 "\"$coid\"\,\"".join ('","', @file_line_contents); }
It should be simple to adapt if the assumptions being made are not applicable.

You must always remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.