#### #### #!/usr/bin/perl use strict; use warnings; use HTML::TreeBuilder; use HTML::Element; my $body =HTML::TreeBuilder->new_from_file(*DATA); print $body->as_HTML('<>&',' ',{}) . "\n"; my %meta= ( "Author"=>"J K Rolling", "title","Harry Potter and the Philosopher's Stone" ); my $head = $body -> find_by_tag_name('_tag', 'head'); for my $m (sort keys %meta) { my $m_el = HTML::Element->new('meta'); $m_el->attr('name',$m); $m_el->attr('content',$meta{$m}); $head->push_content($m_el); } my $out = $body->as_HTML('<>&',' ',{}); print $out; __DATA__ Hello World

Books by J K Rolling