manne has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
$dbh = &{ $db_data->{db_info}->{dbh}->{$database} }( $db_data->{db_inf +o} );
The above line was working fine till same code was used in another perl module file,now there is an error saying that Can't use string ("") as a subroutine ref while "strict refs" in use.

Hope i can fix this error with your help.
Thankyou

Replies are listed 'Best First'.
Re: subroutine ref error
by Anonymous Monk on Oct 26, 2010 at 23:29 UTC
    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).