Hier ist noch mal mein Code Ohne " RENNE" Lösung use strict; use warnings; use DBI; use Net::Telnet::Cisco; use Digest::MD5; our $dbh; open(DAT, '<','../gate_common/MySQLAccount.txt') or  die"Could not open SQL-Data-file!"; $raw_data=; close(DAT); chomp $raw_data; my  ($host,$user,$pass,$db) = split(/:/, $raw_data); print "host ".$host."\n"."user ".$user."\n"."pass ".$pass."\n"."db   ".$db."\n"; $dbh = DBI->connect("DBI:mysql:".$db.":".$host,$user,$pass) or die "Connect Error: $DBI::errstr()\n"; my @Routerlist =( [ qw/1  router3 10.100.2.99  admin router/ ],   [ qw/2  router9 10.100.2.105 admin router/ ], ); for my $cisco ( @ciscolist ) { get_Router( @{ $cisco } ); } $dbh->disconnect; sub get_Router { my $neid=shift; my $machine=shift;  my $ip=shift;  my $user=shift;  my $pwd=shift; my ($query,$sth,$sth1,$execu,$newdata,$ds, $datarefid); if (!$loggedin)    {    eval    {     print "$stext:Try connecting via telnet...\n";     $session = Net::Telnet::Cisco->new(-Timeout => 10);     $session->open($ip);     $session->login($user,$pwd);     $loggedin=1;    };     if ($@) # Ist ein Fehler aufgetreten     {     $session->close;         print "Router nicht erreichbar/kann nicht einloggen \n"; $query="SELECT ID, ASTATE, RefID FROM STATE WHERE NEID='$neid' ORDER BY  DESC LIMIT 1";            $sth = $dbh->prepare($query) or die "Querry Error prepare: $DBI::errstr\n";            $sth->execute or die "Querry Error execute: $DBI::errstr\n";                if ($Astate )                    {$sth->finish;                                   $loggedin=0; } if ($loggedin) { $query="INSERT INTO DATEN(ID,Type,Name,Address,Referenz,Data_RefIerenz,User_ID) VALUES ('',2,'','$ip',$neid,0,0)";                $sth = $dbh->prepare($query) or die "Querry Error prepare: $DBI::errstr\n";                $ds = $sth->execute or die "Querry Error execute: $DBI::errstr\n";                $datarefid = $dbh->{'mysql_insertid'};                $sth->finish(); }