in reply to subroutine ref error

The error means that this part

$dbh = &{ $db_data->{db_info}->{dbh}->{$database} }( $db_data->{db_inf +o} ); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
evaluates to the empty string. We can't tell you why, though, because we don't know what's in that data structure/variable. You'll have to find out yourself (e.g. using Data::Dumper).