Does your script give you any debugging information when is exits? I suspect it is as simple as you are not handling the error conditions properly, as described in
Net::Telnet (look for
errmode). You could probably fix this simply with a
next:
if ($telnet_err){
print "Unable to telnet to $host machine\n";
next;
}