My script terminates if it can not telnet to the host in the array and does not loop through rest of the hosts in the array. How do I force it to continue to other hosts if it fails to telnet one host. here is the script:
use Net::Telnet; @hosts = ("ncc1","ncc2","ncc3") for ($x=0; $x <= $#hosts; $x++) { $telnet = new Net::Telnet ( Timeout=>10, Errmode=>'die'); $telnet->open("$hosts[$x]"); $telnet->login('test', 'testuser'); my @arr = $telnet->cmd('ifconfig -a'); $telnet->close("$host"); print "\n Probe - $host \n"; print "\n @arr \n" ; }
Edit by castaway - fix code tags
In reply to Net::Telnet by GS
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |