Your code declares two lexical variables called $dbh, and each refers to a different variable. The second one masks the first - It's a brand new variable and it is undefined.
In the sub, try my $dbh = shift; in place of my $dbh;.
If this is the case then follow my previous suggestion and use Data::Dumper to print out the database handle right before your error and see what you get.
sub store_items {
my $dbh = shift;
use Data::Dumper;
print Dumper $dbh;
...