文件没有下载,请帮忙。正在下载文本文件:Perl
#!/usr/bin/perl -w
require HTTP::Response;
require LWP::UserAgent;
open (INPUT, "ndb_id_file.txt") or die "can't open ndb_id_file.txt";
@input = <INPUT>
foreach $line(@input) {
$ua = LWP::UserAgent->new;
$ua->env_proxy('http');
$ua->proxy(['http', 'ftp'],'http://144020019:*******@netmon.****.ac.in:80');
response =
$ua->get('www.ndbserver.rutgers.edu/files/ftp/NDB/coordinates/na-biol/$line');
if ($response->is_success) {
$content = $response->content();
open(OUT,">$line.pdb") or die "Output file $line cannot be produced... Error...";
print (OUT "$content");
}
}
在代码中使用'use warnings'和'use strict'。 – serenesat 2015-04-04 15:40:17
我使用严格和警告。它说$ $ response,content和line需要一个明确的包名称。我检查了perl模块是否存在cpan LWP :: UserAgent和cpan HTTP :: Response通过命令行。它说这两个模块都是最新的 – phani 2015-04-04 16:35:10
这很有趣。即使没有这些措施,我也会在E:\ Perl \ source \ resp.pl第10行中得到'未引用的字符串“响应”与将来的保留字冲突。','E:\ Perl \ source \ resp中的语法错误。 pl行6附近“$ line(”','E:\ Perl \ source \ resp.pl第17行附近的语法错误,}“','执行E:\ Perl \ source \ resp.pl中止编译错误。“你真的无法自己解决这些问题吗? ' – Borodin 2015-04-04 22:25:26