You are looking at a very old, but free version of the course. If you are interesed the most recent version, check it out on the Perl Maven site.

8.2. Socket level programming using

Example 8-1. examples/network/

use strict;
use warnings;

use Socket qw(:DEFAULT :crlf);

# Using the built in "socket" function with various helper variables
# and functions from the standard module

# get the protocol id (on Linux from /etc/protocols)
my $protocol_id     = getprotobyname('tcp');  

# build C structure in_addr from hostip
# if hostname is given it tries to resolve hostname to ip first (and returns
# undef if not successful)
#my $host = '';
my $host = 'localhost';
#my $host = '';
#my $host = '';
my $host_struct = inet_aton($host);  
# inet_ntoa($host_struct) returns the resolved ip address

my $port   = 80;

socket(my $socket, PF_INET, SOCK_STREAM, $protocol_id) or die $!;
my $sockaddr_in = pack_sockaddr_in($port, $host_struct);

connect($socket, $sockaddr_in) or die $!;

# turn off buffering on the socket
    my $old = select($socket);
    $| = 1;

print $socket "GET /$CRLF";
while (my $line = <$socket>) {
    print $line;

If you are interested in on-site trainings by the author, please contact me directly.