use strict; use warnings; use 5.010; use IO::Socket; my $host = 'localhost'; my $port = 'daytime(13)'; #Error on this line: my $sock = IO::Socket::INET->new( Proto => 'tcp', PeerHost => $host, PeerPort => $port, ) or die "cannot connect: $!"; while (<$sock>) { print; }