Master file employee ID, name, surname, other fields 1,nitin, abc,... 2, aa, bb,.. 3,cc,dd,.. 4, ee, ff #### employee ID, name, surname, other fields 1,nitin1, abc1,... 2, aa1, bb1,.. 3,cc1,dd1,.. 4, ee11, ff1 #### Employee Number~Category Number~Forename~Surname~Initials~NI Number~Title~Gender~Marital Status~Date of Birth~Home Address Line 1~Home Address Line 2~Home Address Line 3~Home Town/City~Home County~Home Post Code~Employee Contribution %~Employer Contribution %~Annual Salary~Date of Joining Scheme~Date of Joining Company~Exchanged %~Scheme Joiner D51231~ORDM~Charles~Smith~C T~NP307342C~Mr~Male~S~15/10/1971~45 Board Walk~Springer Lane~Mundesley~Norfolk~~NR28 3JK~0.00~8.00~72800.00~01/09/2014~04/08/2014~2.00~N F78321~SMG1~Janet~Patterson~J M~AA112233A~Ms~Female~~21/07/1975~12 Sheringham Way~Cromer~~~~NR21 9BG~0.00~31.00~320000.00~01/09/2014~25/08/2014~0.00~N #### Employee Number~Category Number~Forename~Surname~Initials~NI Number~Title~Gender~Marital Status~Date of Birth~Home Address Line 1~Home Address Line 2~Home Address Line 3~Home Town/City~Home County~Home Post Code~Employee Contribution %~Employer Contribution %~Annual Salary~Date of Joining Scheme~Date of Joining Company~Exchanged %~Scheme Joiner D51231~ORDM~Nitin~Rane~C T~NP307342C~Mr~Male~S~15/10/1971~45 Board Walk~Springer Lane~Mundesley~Norfolk~~NR28 3JK~0.00~8.00~72800.00~01/09/2014~04/08/2014~2.00~N F78321~SMG1~AAA~BBB~J M~AA112233A~Ms~Female~~21/07/1975~12 Sheringham Way~Cromer~~~~NR21 9BG~0.00~31.00~320000.00~01/09/2014~25/08/2014~0.00~N #### my $dbh = DBI->connect('dbi:CSV:', "", "", { f_dir => "$_ENV::LogsFilesDIR/", f_ext => ".txt", eol => "\n", sep_char => "~", RaiseError => 1, }) or die $DBI::errstr; print $ceridian_raw_files; if ($ceridian_raw_files =~ m/^$_ENV::new_entrants/i) { print "inside dbi $ceridian_raw_files\n"; my $sth = $dbh->prepare("select forename from $ceridian_raw_files"); $sth->execute(); my $res = $sth->fetchall_arrayref(); use Data::Dumper; print $res; #### my $dbh = DBI->connect("dbi:CSV:f_dir=$_ENV::LogsFilesDIR;csv_sep_char=\\~") or die $DBI::errstr; $dbh->{'csv_tables'}->{'prospects'} = { 'file' => 'cimp_new_entrant.txt'}; $dbh->do("UPDATE prospects SET Forename = 'Nitin'"); my $sth = $dbh->prepare("select Forename from prospects"); $sth->execute(); while (@row = $sth->fetchrow_array) { print @row; } $sth->finish( ); $dbh->disconnect( );