Help for this page

Select Code to Download


  1. or download this
    my $host = 'localhost';
    my $path = '/cgi-bin/second.pl';
    my $port = 80;
    
  2. or download this
    my $CONN = IO::Socket::INET->new("$host:$port")
       or die "Couldn't connect: $!";
    
  3. or download this
    my $req = "GET $path HTTP/1.0 $CRLF$CRLF";
    $CONN->syswrite($req);
    
  4. or download this
    $/ = CRLF . CRLF;   #To read the whole header as one 'line'
    binmode $CONN;      #Turn off \n conversion for getline() in next line
    ...
    Content-Length: 294
    Connection: close
    Content-Type: text/html
    
  5. or download this
    my $CONN = IO::Socket::INET->new(
        Peerhost    => $host,
        Peerport    => 'http(80)',
    ) or die "Couldn't connect: $!";
    
  6. or download this
    Use of uninitialized value $header in substitution (s///) at 4perl.pl 
    +line 55.
    Use of uninitialized value $header in say at 4perl.pl line 56.
    
  7. or download this
    use strict;
    use warnings;
    ...
    say $header;
    
    $CONN->close;