$| ++; use IO::Socket; use strict; use warnings; my $handle = IO::Socket::INET->new( PeerAddr => "localhost", Proto => 'tcp', PeerPort => "6941") or die "can't connect to port 6941 on host localhost: $!"; print "[Connected to host:6941]\n"; my $line = <$handle>; print $line; $line = ; print $handle $line; $line = <$handle>; print $line;