in reply to Insert into database table

You should use error-handling like
my $sth = $dbh->prepare($sql) or die $dbh->errstr(); # and $sth->execute() or die $dbh->errstr();