use strict;
use warnings;
use HTML::TreeBuilder;
my $str
= "
"
. "technology of S2S translation, also known as Spoken Language Translation (SLT),
"
. "is a new application of AI,
"
. "- there
"
. "- everyone
"
. "
"
;
# Now create a new tree to parse the HTML from String $str
my $tr = HTML::TreeBuilder->new_from_content($str);
# And now find all tags and create an array with the values.
my @lists =
map { $_->content_list }
$tr->find_by_tag_name('span');
# And loop through the array returning our values.
foreach my $sentence (@lists) {
$sentence =~ s/Spoken/SUBSTITUTION/;
print $sentence, "\n";
}