in reply to Parsing this HTML description

You just need to maintain state. I use HTML::Parser directly. There are two flags. One flip flops as we enter and leave a text12 chunk. The other counts text12 chunks. You could just as easily trigger on the <span id='fulldescription'> tag.

use HTML::Parser (); my $CHUNK = 2; # get Nth instance of text12 $p = HTML::Parser->new( api_version => 3, start_h => [ \&start, "self, tagname, attr" ] +, end_h => [ \&end, "self, tagname" ], text_h => [ \&text, "self, dtext" ] ); $p->parse_file(*DATA); sub start{ my ( $self, $tagname, $attr ) = @_; if ( $tagname eq 'div' and $attr->{class} eq 'text12' ) { $self->{text12}++; $self->{text12_item}++; } } sub end{ my ( $self, $tagname ) = @_; $self->{text12} = 0 if $tagname eq 'div'; } sub text{ my ( $self, $text ) = @_; print $text if $self->{text12} and $self->{text12_item} == $CHUNK; } __DATA__ <div class="text12"> Chunk 1 </div> <div class="text12"> Chunk 2 </div> <div class="text12"> Chunk 3 </div>

cheers

tachyon