#!/usr/bin/perl -w
use strict;
use HTML::TokeParser;
my $dir = "c:/windows/desktop/book/work/";
my $file = $dir."work_introduction.htm";
my $p = HTML::TokeParser->new($file) || die "Can't open $file: $!";
while (my $token = $p->get_tag(qw(h1 h2 h3 h4))) {
my $open = $token->[0];
my $close = '/'.$open;
my $text = $p->get_trimmed_text($close);
print "<$open>$text<$close>\n";
}