#!/usr/bin/perl -w use strict; use IO::Socket::INET; #-- #-- client.pl #-- my $server = IO::Socket::INET->new(PeerAddr => 'localhost', PeerPort => 5050, Proto => 'tcp') || die $!; my $file = 'tmp.txt'; #-- #-- send the file name to server.pl #-- print $server "$file\n"; #-- #-- and then the content #-- open(FILE,$file) || die $!; print $server $_ while(); close(FILE); close($server); __END__