in reply to net::telnet errmode issue

I strongly suggest you read Tutorial the section on how to ask a question. Very few monks with bother to read 100+ lines of code. You probelm is one of design, or rather the lack of it. The logic you need is trivial.....

my $connection; while(1) { # the connect method either returns a valid connection object or u +ndef, ERR_MSG print "Trying to connect....."; ($connection, my $error) = connect(); if ( $connection ) { print "Connected OK!\n"; last; } else { print "Connect failed error: $error, retry in 5 sec.\n"; sleep 5; } } # now do stuff with your $connection

cheers

tachyon