use Socket; # declare some self describing constants use constant DEFAULT_ADDR => '127.0.0.1'; # the local host use contant PORT => 13; # well known daytime service port use constant IPPROTO_TCP => 6; # lets use TCP shall we # get host from commandline or use default my $address = shift || DEFAULT_ADDR; # well IP address is really a 32bit UINT my $packed_addr = inet_aton($address); # whoops better include socket/port my $destination = sockaddr_in(PORT, $packed_addr); #ok lets put it together get ourselfs a SOKET handle socket(SOCK,PF_INET, SOCK_STREAM, IPPROTO_TCP) or die; # hey man whats the time connect(SOCK, $destination); print ; # ## there is a lot of good stuff around the Monasterary on this ##subject, like why it is often not a good idea to use things like ## print and $line = #