use HTML::LinkExtor; my $p = HTML::LinkExtor->new(\&spider, "http://www.perl.com"); sub spider { # code omited } $p->parse_file("index.html");