sad1fun has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Hello All
by AppleFritter (Vicar) on Jun 25, 2014 at 18:01 UTC

    I'd use LWP::UserAgent to make the request(s). You'll get a HTTP::Response object; call ->headers() on that and you'll end up with a HTTP::Headers object that you can query as needed.

    Here's some skeleton code to get you started (<s>*completely* untested!</s> now marginally tested):

    #!/usr/bin/perl use feature qw/say/; use strict; use warnings; use LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy(); open my $ips, "<", "ips.txt" or die "Cannot open ips.txt: $!"; while(<$ips>) { chomp; my $response = $ua->get("http://$_/"); unless($response->is_success) { warn "Failed to process $_: " . $response->status_line; next; } say "Headers for $_:"; my $headers = $response->headers(); foreach my $header ($headers->header_field_names()) { say "\t$header: " . $headers->header($header); } say ""; }

    Processing the results in the desired fashion is left as an exercise for the reader.

Re: Hello All
by jellisii2 (Hermit) on Jun 25, 2014 at 18:47 UTC
    What have you tried? If you wish this code written, I (among many others) can provide you with an hourly rate offline.