Perl DBI Sample with MySQL DDL
Couple of things I noticed:

When you connect to the database, you don't check that the connection succeeded. The most common way I've seen to do this in Perl is:

my $connect = DBI-&gt;connect($dsn, $username, $password)
   or die "Connection Error:  DBI::errstr\n";


If the connection fails, the program will then display the connection failure message so you can see what's going on.

I see that you use two different ways of accessing the database. It would be better to pick one and use it for all your inserts/updates unless there is a compelling reason not to - it keeps future readers from trying to figure out why you did it differently. In this case I'd reccomend using execute since it allows you to execute multiple times:

$query_handle = $connect-&gt;prepare("INSERT INTO dbtable (id, demo) VALUES (?, ?)");
$query_handle-&gt;execute($id, $demo);
$id = 2;
$demo = "test2";
$query_handle-&gt;execute($id, $demo);


Also don't forget to disconnect:

$connect-&gt;disconnect;