in reply to Identifying PDF from URLs

What you probably want to do is use one of the CGI modules to get and check the header for the url, hopefully the header will be set with one of the pdf related mime types.
the hardest line to type correctly is: stty erase ^H