Yeah, there are some cut-n-paste errors above. Unfortunately you didn't provide a complete example for me to test my code with.
First suggestion is to get rid of the "or die" statements, by specifying the raise error option during the dB connect. A little short of time this morning, but the below is some actual working code from a few days ago on an SQLite DB. I use $dbh for the data base handle. You can follow this pattern.
my %attr = ( RaiseError => 1); #auto die with error printout
my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfilename","","",\%attr)
or die "Couldn't connect to database $dbfilename: " . DBI->errstr;
my $get_qsos = $dbh->prepare ("SELECT * FROM raw_qsos
WHERE
rcv_call = ?");
$get_qsos->execute($call);
my $resultRef = $get_qsos->fetchall_arrayref;
my $n_dbQso = scalar(@$resultRef); #number of rows with that call