#!/usr/bin/perl use warnings; use strict; use LWP::Simple; use HTML::TokeParser::Simple; my $html = get(qq{http://search.cpan.org/}); my $p = HTML::TokeParser::Simple->new(\$html); my $start_found; while (my $t = $p->get_token){ $start_found++, last if ( $t->is_start_tag(q{center}) and $t->get_attr(q{class}) and $t->get_attr(q{class}) eq q{categories} ); } die qq{tag not found} unless $start_found; my $center_html; while (my $t = $p->get_token){ last if ( $t->is_end_tag(q{center}) ); $center_html .= $t->as_is; } die qq{no content found} unless $center_html; print $center_html;