my $twig = new XML::Twig( TwigHandlers => { 'byline' => \&byline, 'body.head/hedline' => \&hedline, 'body.content/p' => \&process_p, 'body.content/hl2' => \&process_body_hl2, 'body.content/block/p' => \&process_p, 'body.content/block/hl2' => \&process_body_hl2, 'body.content/table' => \&process_table, etc. etc. #### sub process_body_hl2 { my ($t, $hl2) = @_; my $para = crunch($hl2->text); $body .= "

$para

"; } ##
## SECTION HEAD subhead

####

SECTION HEAD

subhead

####

2nd subhead ####

2nd subhead