#open file1, split each line delimited by comma and read into %hash #assume $code, and $description are the key/value pairs of the %hash. #open file2 and read into array while { my @array2 = ; } #close file2 #open file2 foreach $item (@array2) { @values = split /,/; $values[4] = $hash{$values[2]}; # this should now put the new description from the hash print file2 $values[1], ", ", $values[2], ", ", $values[3], ", ", $values[4], ", ", $values[5], ", ", "\n"; # writing the line back into file2 }