my $ua = LWP::UserAgent->new; my $uri = shift @ARGV; my $headreq = HTTP::Request->new(HEAD => $uri); my $headres = $ua->simple_request($headreq); # <---- my $statuscode = $headres->code(); print "Status 401 at $uri\n" if $statuscode == 401;