Esteban, gracias por tu respuesta, con base a ello contruí el sig. script:
Código:
#!/usr/bin/perl -w
package file;
use strict;
use DBI;
my $db_user = "aaa";
my $db_pass = "bbb";
my $host_name = "10.10.10:2210";
my $db_name = "base";
# vars
my $q_string = "DBI:mysql:host=$host_name;database=$db_name";
sub connect{
return (DBI->connect ($q_string, $db_user, $db_pass,
{PrintError => 0, RaiseError => 1}));
}
my($dbh,$sth);
$dbh = file->connect();
$sth = $dbh->prepare('select max(id_tabla1)+1 numero from tabla1') or die("Couldn't prepare statement: " . $dbh->errstr);
$sth->execute() or die("Couldn't execute statement: " . $sth->errstr);
my $maxnum = $sth->fetchrow_array();
$sth->finish;
$sth1-> $dbh->prepare('insert into tabla1 (id_tabla1) values ($maxnum')
$sth1->execute() or die("Couldn't execute statement: " . $sth->errstr);
$sth1->finish;
$dbh->disconnect;
1
exit;