I think you are going to need to provide more details. Are you using a module for telnet? If so, which one? I don't understand what you expect to accomplish with select(undef, undef, undef, 5). I have not used it like this personally, but according to perldoc, this is really equivalent to sleep (5). Is that really what you want?