#!/usr/bin/perl $|++; use strict; use warnings; use IO::Socket; my $host = '0.0.0.0'; my $port = 80; my $socket = IO::Socket::INET->new( PeerHost => $host, PeerPort => $port, Timeout => 5, ) or die "Failed to connect to $host on $port: $!"; $socket->autoflush(1); print "Host reached\n-----------------\n" ; my $lines = 'GET /index.html'; $socket->send($lines . "\n"); while( defined( my $line = $socket->getline() ) ){ print $line; }