#!/usr/bin/perl # Pseudo-Perl; some code shortened to ellipses or text. use IO::Socket; my $sock = IO::Socket::INET->new(...) or die "..."; while (not yet done) # Not sure how you want to determine this { my $line; print $sock "send this to server\n"; chomp($line = <$sock>); # } __END__