in reply to Inserting new column

 open my $in, "+<:encoding(utf8)"

You know utf8 is not the same as UTF-8

 use autodie; ...  or die $!;

hah :)

 my @name = split _,$file; my $grpid = $name[0] ; my $grpname = substr($name[1], 0,-4);

see see perlintro#Parentheses for capturing and http://perldoc.perl.org/perlrequick.html#Extracting-matches

while...if($.==1) ...

No need to put the first getline into the loop, just do it before the loop

 #$csv->print($in, @$row);

You need an $outcsv because Modifying an existing file is three steps :)

  1. read old file
  2. create a new file
  3. rename new file to name of old file