foreach(@urls) { my $ua = LWP::UserAgent->new(); my $url = "$_"; my $response = $ua->head($url); #HTTP::Response type return my $headers = $response->headers(); # HTTP::Headers type return my $content_type =$headers->content_type(); # string print "$content_type\n"; } if($content_type eq 'application/pdf') { print "File Exists:\n $_"; } elsif($content_type eq 'text/html') { print "File Exists but requires subscription to access:\n"; } else{ print "No Matching found"; }