in reply to Re: Parsing HTML with TreeBuilder
in thread Parsing HTML with TreeBuilder

The row can contain both types of cells, and I would like to be able to tell the difrence between the to kinds of cells. The one with just links and the ofhter with links inbedded in text segments.

Replies are listed 'Best First'.
Re: Re: Re: Parsing HTML with TreeBuilder
by Chmrr (Vicar) on Sep 20, 2002 at 07:25 UTC

    Assuming that $ele is an HTML::Element object containing your <td> element, then:

    if (grep {!ref($_) or $_->tag ne "a"} $td->content_list) { # The element has non-link text } else { # The element only has <a></a> elements in it }

    See the HTML::Element documentation for more information. There may be a more efficient method than the above, but you havn't specified your problem well enough for me to see it.

    perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&V"+@( NO CARRIER'