in reply to Cisco Telnet

The Net::Telnet module by default dies when a timeout occurs. You should add the 'Errmode' type in the constructor:
my $ip = 'x.x.x.x'; my $session = Net::Telnet::Cisco->new( Timeout => 10, Errmode => 'retu +rn');
And next, a handle for the error. In this case, the script closes the tcp session:
$session->open($ip); if($session->errmsg){ $session->close; }
Check the Net::Telnet module for more info. I personally use this module to automate Cisco tasks because I have found some problems with the Net::Telnet::Cisco module.