perl爬虫收集当前页面所以链接地址,不需要用HTML::LinkExtor模块

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";

编程技巧