in reply to Removing doubles and printing only unique values

I strongly recommend you use Text::CSV for CSV input/output, your script will end up much more robust and probably a bit shorter (also install Text::CSV_XS for speed). I gave an example of CSV input and output here. Update: Copied over code example (with minor adaptations):

use warnings; use strict; use Text::CSV; my $csv = Text::CSV->new({ binary=>1, auto_diag=>2, eol=>$/, sep_char => ";" }); open my $ifh, '<', 'Input.CSV' or die $!; open my $ofh, '>', 'Output.CSV' or die $!; while ( my $row = $csv->getline($ifh) ) { # your logic to modify data here $csv->print($ofh, $row); } $csv->eof or $csv->error_diag; close $ifh; close $ofh;

Replies are listed 'Best First'.
Re^2: Removing doubles and printing only unique values
by zarath (Beadle) on Oct 31, 2017 at 13:53 UTC

    Thank you for the suggestion.

    In this case I won't be using that, just because I now have a working script and I can completely trust the inputfile will be clean. Plus, this script needs to run on an external server, Text::CSV is not installed and I am not allowed to install whatever I want there, so have to make it work with the tools at hand. Oftenly there is no speedboat here, so we have to use the rowboat.

    But I will definitely install it on my laptop, it indeed looks like it could make for a much cleaner script than what I oftenly write :-)