in reply to Extracting href's
use HTML::TreeBuilder; # given that the HTML to be parsed is in a variable named $html . . +. # this line extracts the links from the html: my $links = HTML::TreeBuilder->new_from_content( $html )->extract_li +nks; # and this iterates over the list of link data, slightly massaging e +ach one: for ( map { [ $_->[0], ( $_->[0] =~ m#://(.*)# ), $_->[1]->as_text ] + } @$links ) { # here are the three variables you wanted: my( $url, $address, $text ) = @$_; }
jdporter
The 6th Rule of Perl Club is -- There is no Rule #6.
|
|---|