sub add_auto_increment_record { my ($self,$dbh) = @_; my $sql =<<EOF; insert into test_table (key, val) values (?, ?) EOF my $sth = $dbh->prepare($sql); my @vals = ('FOO','BAA'); unless($sth->execute(@vals)){ $self->error( $sth->errstr ); return undef; } return $sth->{mysql_insertid}; }