use YAPE::HTML; use strict; my ($some_html,$p,$ext) = ("..."); $p = YAPE::HTML->new($some_html); while (my $chunk = $p->next) { if ($chunk->type('tag') and $chunk->tag('cs')) { print ""; } elsif ($chunk->type('closetag') and $chunk->tag('cs')) { print ""; } else { print $chunk->string } }