#!/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...
In reply to Re: Perl as a telnet server?
by osama
in thread Perl as a telnet server?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |