in reply to Sockets

Curious, what did this snippet do for you?
$SIG{CHLD} = sub {wait()};

and what about this part?
} else { $line = <STDIN>; print $new_sock "$line"; }


Also, how do you get the server to hang up on the client? I tried something like:
chomp($buf); exit(0) if ($buf eq 'q');

But the client (I use telnet) connected to the server holds fast until I hit <CR> on the console that's running the server.