my $parentId = $q->param('annual'); my $thisSession = $q->param('id'); tie my %obj, 'Tie::DBI', $dbh, 'conference_event','id', { CLOBBER => 1, WARN => 1, DEBUG => 1, CASESENSITIV => 1 } ; my @keys; if ( ! $thisSession ) { my $tempId = (keys %obj)[-1]; @keys = keys %{ $obj{$tempId} }; $thisSession = $tempId + 1; } else { @keys = keys %{ $obj{$thisSession} }; } my $newVals; foreach my $key ( @keys ) { $newVals->{$key} = $q->param($key) || $obj{$thisSession}->{$key}; } $newVals->{'id'} = $thisSession; $newVals->{'conf_annual_id'} = $parentId; ## $obj{$thisSession} = $newVals; $obj{'id'} = $newVals; #### Ignored attempt to change value of key field "id" at ... (line #) insert into table .... update table set ....