use IO::Socket;
my $server = shift;
my $fh = IO::Socket::INET->new($server);
my $line = <$fh>;
print $line;
####
% perl lgetr.pl mail.hotmail.com:smtp
220 mc5-f26.hotmail.com Sending unsolicited commercial or bulk e-mail to Microsoft's computer network is prohibited. Other restrictions are found at http://privacy.msn.com/Anti-spam/. Violations will result in use of equipment located in California and other states. Sat, 30 Apr 2005 19:25:12 -0700
####
my $fh = IO::Socket::INET->new($server) or die "Socket open failed: $^E\n";
####
% perl lgetr.pl wuarchive.wustl.edu:daytime
Socket open failed: Connection refused
####
use IO::Socket;
my $site = ;
chomp $site;
my $fh = IO::Socket::INET->new($site) or die "Socket open failed: $^E\n";
my $line = <$fh>;
print $line;
__END__
% perl lgetr.pl[HIT RETURN HERE]
mail.hotmail.com:smtp[HIT RETURN HERE]
220 mc5-f26.hotmail.com Sending unsolicited commercial or bulk e-mail to Microsoft's computer network is prohibited. Other restrictions are found at http://privacy.msn.com/Anti-spam/. Violations will result in use of equipment located in California and other states. Sat, 30 Apr 2005 19:28:52 -0700