#!/usr/bin/perl use strict; use LWP::UserAgent; my @list = qw( http://www.yahoo.com http://w1.dev.chaffee.com http://foo.bar ); my $ua = LWP::UserAgent->new(); $ua->timeout(10); for (@list) { my $r = $ua->get($_); print "Try $_\n"; if ($r->code =~ /^(4|5).+/) { print "\n\nError with $_: ".$r->code.": ".$r->message.$/.$/; } }