Perl 使用 Net::FTP 从 FTP 上下载文件

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

use Net::FTP;

$ftp = Net::FTP->new("ftp.cpan.org", Timeout => 30)
        or die "Could not connect.\n";

$username = "anonymous";
$password = "asdf";

$ftp->login($username, $password)
        or die "Could not log in.\n";

$ftp->cwd('/pub/CPAN');

$remotefile = "CPAN.html";
$localfile = "file.txt";

$ftp->get($remotefile, $localfile)
        or die "Can not get file.\n";