foreach my $rec (@ODB) { chomp($rec); my %db_rec; @db_rec{@fields} = split /\t/, $rec; if ($db_rec{viewpositionid} == $cur_rec{viewpositionid}) { # Replace the existing with the updated. %db_rec = %cur_rec; $cur_rec{sub_ip} = $ENV{REMOTE_ADDR}; $cur_rec{approved} = "No"; } print DATABASE join "\t", @db_rc{@fields}; print DATABASE "\n"; }