use IO::Socket; my $sock = new IO::Socket::INET ( PeerAddr => 'localhost', PeerPort => '7890', Proto => 'tcp', ); die "Could not create socket: $!\n" unless $sock; my @val = qw(Hello there! this is socket); print $sock @val; close($sock);