in addition to expect, there are various perl implementations of expect as well. also, consider looking at "netcat"; depending on exactly what you're trying to do, it may be easier than expect. t.