use strict; use HTML::Parser; my $content=< Some title goes here
menu column

some text goes here some text goes here
some text goes here some text goes here

some header

some text goes here some text goes here
some text goes here some text goes here

image here

some header

some text goes here some text goes here
some text goes here some text goes here

news column
EOF my $p = HTML::Parser->new( api_version => 3 ); $p->handler( start => \&start_handler, "self,tagname,attr" ); $p->parse($content); exit; sub start_handler { my $self = shift; my $tagname = shift; my $attr = shift; return unless ( $tagname eq 'div' and $attr->{id} eq 'body' ); $self->handler( text => sub { print shift }, "dtext" ); $self->handler(end => sub { shift->eof if shift eq $tagname; }, "tagname,self"); }