my $req = HTTP::Request->new(HEAD => $url); my $resp = $ua->request($req); my $type = $resp->header('Content-Type'); my $content = $resp->content; my $content_len = $resp->header('Content-Length');