Хотел переписать скрипт телнета под ссш но мало что получается подскажите где ошибка
use strict;
use Net::Telnet;
use DBI;
use Term::ReadKey;
use Net::SSH::Perl;
use Math::BigInt::Calc;
my $DEBUG = 1;
my $dbh = DBI->connect("DBI:mysql:database=switches;host=localhost","login","pass") || die $DBI::errstr;
my $sth = $dbh->prepare("SELECT id,ip,type_id,login,pass FROM switches WHERE type_id LIKE '%zyxel2024%m4%'");
$sth->execute;
my $t2 = new Net::SSH::Perl(
host=> $cmd_login2,
Timeout => 5,
Prompt => '/(:[0-9]|:([a-zA-Z]+?))#$/',
ssh_option => '-o StrictHostKeyChecking=no',
);
while(my $ref = $sth->fetchrow_arrayref)
{
my $id = $$ref[0];
my $ip = $$ref[1];
my $type_id = $$ref[2];
my $login = $$ref[3];
my $pass = $$ref[4];
$cmd_login2 = "$$ref[3]\@$$ref[1]";
eval
{
print "\nSwitch: $ip (type $type_id) ... " if $DEBUG;
$t2= Net::SSH::Perl->new($cmd_login2);
print($t2->get);
print "Connected... " if $DEBUG;
$t2->print($pass);
print($t2->get);
print "Pass in... " if $DEBUG;
sleep 5;
$t2->print("show vlan");
print($t2->get);
print "Send comand" if $DEBUG;
$t2->close;
};
print $@ if $@;
}