use IO::Socket::INET; my $sock = IO::Socket::INET->new( Proto => 'tcp', PeerAddr => 'localhost', PeerPort => 5003, ) or die $!;