poj#!/usr/local/bin/perl use strict; use warnings; use HTML::TreeBuilder; my $html = do{local $/;<DATA>}; my $tree = HTML::TreeBuilder->new; $tree->parse( $html ); my @nodes = $tree->look_down( _tag => "a", \&a_tag ); sub a_tag { my ($element) = @_; my $parent = $element->parent; my $text = $element->as_text; if ($parent->tag eq 'span'){ print "Speaker = $text\n"; # set current author } elsif ($parent->tag eq 'b' && $parent->as_text =~/(Session|Tutorial)/){ print "$1 = $text\n"; # add record to current author } }
In reply to Re: Parse HTML page for links and count by author
by poj
in thread Parse HTML page for links and count by author
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |