use DBI; my $dbh; open_db_conn(); my @active_homes = get_active_homes(); $dbh->disconnect(); sub open_db_conn { my $dbd = "mysql"; my $host = "host_name"; my $db_name = "db_name"; my $user = "login"; my $password = "pass"; my $dsn = "DBI:$dbd:$db_name:$host"; eval { $dbh = DBI->connect( $dsn, $user, $password, { RaiseError => 1, AutoCommit => 0 } ); }; print "Could not open database connection: $@" if $@; } # &open_db_conn # Get active homes. # sub get_active_homes { my $sth = $dbh->prepare( qq{ call myProc() } ); $sth->execute(); print "Trouble with database connection: $@" if $@; } # &get_active_homes #### cpan[1]> i DBD::mysql CPAN: Storable loaded ok Going to read /u/user/.cpan/Metadata Database was generated on Wed, 13 Jun 2007 03:07:59 GMT Strange distribution name [DBD::mysql] Bundle Bundle::DBD::mysql (CAPTTOFU/DBD-mysql-4.005.tar.gz) Module DBD::mysql (CAPTTOFU/DBD-mysql-4.005.tar.gz) 2 items found cpan[2]> i DBI Strange distribution name [DBI] Bundle Bundle::DBI (TIMB/DBI-1.56.tar.gz) Module DBI (TIMB/DBI-1.56.tar.gz) 2 items found