in reply to Perl as a telnet server?

why not use inetd or xinetd? they handle the sockets, sessions, concurrent connections, and host security parts pretty well...
They would listen to a specified port (23 or any other port, you could telnet hostname XXX to connect to port XXX) and run your script redirecting stdin/stdout to that connection.. Your script can be as simple as you want,dumb example:
#!/usr/bin/perl -w use strict; $|=1; print "What is your name?"; my $name=<>; chomp $name; print "Hello, $name, nice to meet you\n\n"; my $choice=''; while($choice ne 'q') { print "a. Print 1+1\n"; print "b. Print Hi\n"; print "q. Quit!\n"; $choice=<>; chomp $choice; if ($choice eq 'a') {print "1+1=2\n";} if ($choice eq 'b') {print "Hi $name !\n";} }

How to use xinetd on linux/unix:

remeber to disable output buffering $|=1

Simple: create a file /etc/xinetd.d/yourscriptname with

service yourscriptname { disable = no socket_type = stream wait = no user = root server = /path/to/your/script }

also add to your /etc/services:

yourscriptname portno/tcp

There are inetd ports to windows...