my ($title) = $chunk =~ /
##
use strict;
use warnings;
use Data::Dumper;
use HTML::TokeParser::Simple;
my $d = do {local $/;};
my $p = HTML::TokeParser::Simple->new(\$d);
my %hash;
while ( my $token = $p->get_token ) {
$hash{title} = $p->get_token->return_text
if $token->is_start_tag('title');
push @{$hash{h1}}, $p->get_token->return_text
if $token->is_start_tag('h1');
}
print Dumper \%hash;
__DATA__
foo
one
two
three