Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I need to download file from a url using PERL script. Problem is url does not end with a file name. URL is like "www.xyz.com/list/dir/" It does not contain filename. As soon as i type this type of url in browser, popup message gets displayed that Whether you want to open the file or save it. And the name of the file is in that dialog.

Replies are listed 'Best First'.
Re: Download file
by ikegami (Patriarch) on Jan 14, 2009 at 20:08 UTC

    A file name may be available via a Content-Disposition header.

    By the way, the name of the language is Perl.

    By the way, www.xyz.com/list/dir/ is a very different URL than http://www.xyz.com/list/dir/.

Re: Download file
by zentara (Cardinal) on Jan 14, 2009 at 20:28 UTC
    When you are just dumped into a directory like that, you get a default page defined by the server configuration, like index.html or index.cgi. So you need to use something like WWW::Mechanize. Try wget for a quick solution.

    I'm not really a human, but I play one on earth Remember How Lucky You Are