Treebuilder Get Embedded Nodes
Basically, I need to get the names and emails from all of these people in the HTML code.
use strict;
use warnings 'all';
use LWP::Simple 'get';
use HTML::TreeBuilder;
use constant URL =>'http://pastebin.com/raw/qLwu80ZW';
my $tree = HTML::TreeBuilder->new_from_content(get URL);
my ($table) = $tree->look_down(_tag =>'table', class =>'rgMasterTable');
formy $tr ( $table->look_down(_tag =>'tr') ) {
nextunlessmy @td = $tr->look_down(_tag =>'td');
my ($name, $email) = map { $_->as_trimmed_text } @td[0,1];
printf"%-17s %s\n", $name, $email;
}
output
Michael Bowen mbowen@cpcisd.net
Christian Calixto calixtoc@cpcisd.net
Rachel Claxton claxtonr@cpcisd.net
Post a Comment for "Treebuilder Get Embedded Nodes"