$| = 1;
while (1)
{
$_ = <>;
open FILE, ">/tmp/moo1"; print FILE $_; close FILE;
chomp;
open FILE, ">/tmp/moo2"; print FILE $_; close FILE;
last if $_ eq "y";
}
Checking the files:
> od -c /tmp/moo1
0000000
> od -c /tmp/moo2
0000000 y \r
0000002
####
#!/usr/bin/perl -w
use strict;
# for telnet, turn off buffering.
$| = 1;
while (1)
{
print "? ";
$_ = <>;
#print(unpack('H*', $_), "\n");
print $_;
open FILE, ">/tmp/moo"; print FILE $_; close FILE;
last if $_ eq "y";
}
print "\n";
####
service test
{
disable = no
socket_type = stream
wait = no
user = chacham
server = /home/chacham/test.pl
}