Thank you all - here is the working code segment:
#################################### //code this below to loop through
+ all the servers with DB connection, join all results into one array
+####################################
my $dsn = "DBI:mysql:table:localhost";
my $username = "username";
my $password = 'password';
my $dbc = DBI->connect($dsn, $username, $password) or die "Unable to c
+onnect to mysql: $DBI::errstr\n";
#//loop through the servers table to pull data for each server
my $sql = $dbc->prepare("SELECT server_host FROM server_test");
$sql->execute() or die "Unable to execute sql: $sql->errstr";
my $host_array_ref = $sql->fetchall_arrayref() or die "can't get array
+ ref! $sql->errstr";
foreach my $rowref (@$host_array_ref)
{
my ($host) = @$rowref;
print "Calling telenet stuff for $host\n"; #a little debugging ou
+tput is fine
# call your telnet routine on this host
my $device = $host;
my $user = "user";
my $password = "password";
STDOUT->autoflush;
die "Unable to telnet to device\n" if (! (my $session=zhoneConnect($de
+vice)));
die "unable to login to device\n" if (! zhoneLogin($session, $user, $p
+assword));
zhoneCommand($session, "timeout off");
zhoneCommand($session, "setline 0");
$session->prompt('/\n\rAUTO>\s*/');
zhoneCommand($session, "setprompt session AUTO>\r");
my @output=zhoneCommand($session, "bridge show");
for (@output) {
print "$_\n";
}
zhoneDisconnect($session);
}