sub parseResPage { my ( $rawHTML ) = @_; my $tree = HTML::TreeBuilder->new_from_content( $rawHTML ); my @tables = $tree->look_down('_tag', 'table'); # We want the second table my @tableRows = $tables[1]->look_down('_tag', 'tr'); # First row is headings, then the data my $headRow = shift @tableRows; my @headings; my $res_hash; my @cells = $headRow->look_down('_tag', 'td'); push @headings, $_->as_text() foreach (@cells); foreach my $mainRow ( @tableRows ) { my @cells = $mainRow->look_down('_tag', 'td'); my $iface = $cells[0]->as_text(); for( my $i=0; $i{$iface}{ $headings[$i] } = $cells[$i]->as_text(); } } # Explicity free the memory consumed by the tree. $tree->delete(); return $res_hash; }