This works for me and you should be able to modify your script accordingly.

#!/usr/bin/env perl use strict; use warnings; use File::Fetch; my $url = 'http://perldoc.perl.org/File/Fetch.html'; my $ff = File::Fetch->new( uri => $url ); my $where = $ff->fetch( to => '/tmp' ) or die $ff->error; my $file = $ff->output_file(); # name of local file print "Fetched $url and stored as $file.\n";
[mmusgrove@dev2 ~]$ ./ff.pl Fetched http://perldoc.perl.org/File/Fetch.html and stored as Fetch.ht +ml [mmusgrove@dev2 ~]$ ls -al /tmp/Fetch.html -rw-rw-r-- 1 mmusgrove users 38348 Jun 23 2013 /tmp/Fetch.html

Update: I even tested it on Windows with Strawberry Perl.

#!/usr/bin/env perl use strict; use warnings; use File::Fetch; my $url = 'http://perldoc.perl.org/File/Fetch.html'; my $ff = File::Fetch->new( uri => $url ); my $where = $ff->fetch( to => 'C:/TEMP' ) or die $ff->error; my $file = $ff->output_file(); # name of local file print "Fetched $url and stored as $file.\n";
C:\Users\mmusgrove\Desktop>perl ff.pl Fetched http://perldoc.perl.org/File/Fetch.html and stored as Fetch.ht +ml. C:\Users\mmusgrove\Desktop>dir C:\TEMP Volume in drive C has no label. Volume Serial Number is 48AA-B4E2 Directory of C:\TEMP 01/10/2014 11:32 AM <DIR> . 01/10/2014 11:32 AM <DIR> .. 06/23/2013 02:53 PM 38,348 Fetch.html 1 File(s) 38,348 bytes 2 Dir(s) 165,768,085,504 bytes free

In reply to Re^3: Unable to fetch and Attach .htm files by Mr. Muskrat
in thread Unable to fetch and Attach .htm files by naghaveer

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.