in reply to Extract URL from text
Ofcourse there are always HTML::LinkExtor and HTML::SimpleLinkExtor...use URI::Find; my $text = "alot of HTML"; find_uris($text, sub { my($uri, $orig_uri) = @_; print $orig_uri,"\n"; return $orig_uri; });
oruse HTML::SimpleLinkExtor; my $extor = HTML::SimpleLinkExtor->new(); $extor->parse_file($filename); # ---- or ----- $extor->parse($html); #extract all of the links @all_links = $extor->links;
require HTML::LinkExtor; $p = HTML::LinkExtor->new(\&cb, "http://www.perl.org/"); sub cb { my($tag, %links) = @_; print "$tag @{[%links]}\n"; } $p->parse_file("index.html");
|
|---|