I may be missing something here but I can't see where you defined
$dbh. You need to open a connection to the database before preparing you statement handle. if you print
$! in you
die statement, I think you'll get a meaningful error. Anyway, here is the syntax for opening:
my $dbh = DBI->connect($data_source, $username, $auth, \%attr);