in reply to LWP::Simple to judge the url

If you're not fixed on LWP::Simple, here's an example with Mojolicious:
use Mojo::UserAgent; my $url = "http://de.arxiv.org/pdf/1106.3541" print Mojo::UserAgent->new->head($url)->res->headers->content_type;

This prints application/pdf, indicating that document returned from this URL is a PDF file.

Replies are listed 'Best First'.
Re^2: LWP::Simple to judge the url
by Corion (Patriarch) on Jun 20, 2011 at 09:29 UTC

    (and if you don't have Mojolicious installed, LWP::UserAgent does it as well:)

    use LWP::UserAgent; my $url = "http://de.arxiv.org/pdf/1106.3541"; print LWP::UserAgent->new->head($url)->headers->content_type()