Help for this page
use strict; use warnings; ... } die "Too many counts" if @counts;
my $new_text = $node->textContent() x shift(@counts); $node->removeChild($_) for $node->findnodes('text()'); $node->appendText($new_text);