in reply to telnet module

Check out Control::CLI. It makes this kind of stuff a little easier.