#!/usr/bin/perl use strict; use warnings; use IO::Socket; use IO::Select; use IO::Handle; my $server = IO::Socket::INET->new(PeerAddr => "localhost",PeerPort => 5000, Proto => "tcp"); my $sel = new IO::Select; $sel->add($server); while (1) { my @handles = $sel->can_read(0.10); if (@handles) { foreach my $s (@handles) { my $line = <$s>; print $line; } } else { print "."; } }