#!/bin/perl
use strict;
use utf8;
use open IO => ':utf8';
use open ':std', ':utf8';
use feature 'unicode_strings'; # You get funky results with the sub convertNumberedSequencesToChar without this.
use HTML::TreeBuilder 5 -weak;
my $tree = HTML::TreeBuilder->new;
# HTML given is read from a file in UTF-8 format. Using parse_file returns garbled characters.
my $html = 'adv.
1 maldosamente
2 maliciosamente
3 intencionalmente';
# The next 2 lines are added to see whether it would impact losing
tags
$tree->no_space_compacting(1);
$tree->ignore_unknown(0);
$tree->parse( $html );
$tree->eof();
$tree->dump();
print( $tree->as_HTML('&<>') );
####
adv.
1 maldosamente
2 maliciosamente
3 intencionalmente
##
##
$Node->attr("size_of_contents") = scalar( $Node->content_list );
$Node->detach();
$Node->attr("size_of_contents") = undef;
$Node->dump();