my $dbc = DBI->connect($dsn, $username, $password) or die "Unable to connect to mysql: $DBI::errstr\n"; #//loop through the servers table to pull data for each server my $sql = $dbc->prepare("SELECT server_host FROM servers"); my $result = $sql->execute() or die "Unable to execute sql: $sql->errstr"; XXXX ERROR LINE XXXXX my $host_array_ref = $result->fetchall_arrayref() or die "can't get array ref! $sql->errstr"; XXXXXXXXXX foreach my $rowref (@$host_array_ref) { my ($host) = @$rowref; print "Calling telenet stuff for $host\n"; #a little debugging output is fine # call your telnet routine on this host my $device = $host; my $user = "admin"; my $password = "zhone"; STDOUT->autoflush; die "Unable to telnet to device\n" if (! (my $session=zhoneConnect($device))); die "unable to login to device\n" if (! zhoneLogin($session, $user, $password)); 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); }