利用链接下载文件

利用链接下载文件

perl里用什么包的哪个方法能下载已知链接的文件 比如: http://www.sina.com/top.zip
use LWP::UserAgent;
my $filespec="libwww-perl-5.808.tar.gz";
my $url = 'http://search.cpan.org/CPAN/authors/id/G/GA/GAAS/libwww-perl-5.808.tar.gz';   
my $browser = LWP::UserAgent->new;
my $response = $browser->get($url,
                         ':content_file' => "$filespec",);
die "Error at $url\n ", $response->status_line, "\n Aborting" unless $response->is_success;
print "Whee, it worked!  I got that  document!\n";
学习了...