- use LWP::Simple;
- use URI::URL;
- my @collect_url=();
- my $url = "http://pngu.mgh.harvard.edu/~purcell/plink/anal.shtml#model";
- my $html = get( $url );
- $base= "http://pngu.mgh.harvard.edu/~purcell/plink/";
- while ($html =~ m/\\"(.*?)\\"/ig)#匹配的只是相对地址,需要用绝对地址来修改才能下载
- {
- my $new_url = url($1, $base)->abs;
- push @collect_url ,$new_url;
- }
- print join("\\n", @collect_url), "\\n";
- #该片段来自于http://www.codesnippet.cn/detail/2208201410291.html
来源: http://www.codesnippet.cn/detail/2208201410291.html