#!/usr/bin/perl -d:DProf
use Carp;
use Text::Balanced;
our $extract_section_tag = Text::Balanced::gen_extract_tagged( '\n?', '[\S\s]*?(?= 1});
print "Done. Length of newpage=[" . length($newpage) ."]\n";
sub process_section {
my ($page, $hashref) = @_;
my ($tag_section, $post, $pre, $tag_open, $content, $tag_close, @info);
my $return = '';
while ( @info = $extract_section_tag->($page) ) {
($tag_section, $post, $pre, $tag_open, $content, $tag_close) = @info;
if (! (defined $tag_section && length $tag_section) ) {
if ($post =~ m//) {
$show = 1 if (exists $hashref->{$1});
}
if ($show && $content =~ m/