i would like if its possible to write in the log file the error form eval in this code. From "perllogrouter/router$i.log"the eval error to be put there if its possible.
eval { my $session = Net::Telnet::Cisco->new(Host => "$device",
Input_log => "perllogrouter/router$i.log",
);
$session->login(Password => $curpwd);
if ($session->enable("$curpwd"))
{
# Execute a command
@output = $session->cmd ('show running-config | section hostname')
+;
print "@output\n";
print " ======================================================\n";
}
$session->close;
}; if ($@) {print "Error: $@\n"}