You should check out
perl-chat in
Tkil's Perl Examples. It uses the low level calls to select, sysread and syswrite. The diffcult thing about using select is that you can't use <SOCK> and print SOCK with nonblocking io.
When you move to the higher level IO::* you might find Tkil's port-forward a useful guide.